Re: Computing percentage change between tables

From: joel garry <joel-garry_at_home.com>
Date: Mon, 20 Jul 2009 11:47:42 -0700 (PDT)
Message-ID: <14dc94c4-7806-4b41-8d70-1d8a20deac44_at_c1g2000yqi.googlegroups.com>



On Jul 20, 9:40 am, Ed Prochak <edproc..._at_gmail.com> wrote:
> On Jul 20, 4:35 am, novice82 <novic..._at_gmail.com> wrote:
>
>
>
> > Hi,
>
> > I'm a novice to sql scripting. Am trying to figure out a design
> > problem, involving some arithmatic computation.
>
> > I have two tables temp1 and temp2 with two feilds
> > account no., ( Common in both tables )
> > balance ( float data type ).
>
> > 1. I want to compare the balance feilds in temp1 and temp2.
> > print out the no. of accounts and percentage of match and mismatch.

Try something. You might want to search the docs at tahiti.oracle.com for the outer join syntax to account for the case of missing rows.

> > 2. output the a/c nos. whose balances dont match into a seperate
> > table..

When you figure out the syntax, you can do something like create table dontmatch as select <some fields> from <what you figured out>

>
> > another question, that I have is, how does sql handle the computation,
> > if a value in a particular field is divided by 0 ?

What are the business rules for such a situation?

JEG_at_TTST> select 1/0 from dual;
select 1/0 from dual

        *
ERROR at line 1:
ORA-01476: divisor is equal to zero

JEG_at_TTST> select 1/decode('0',0,'100') from dual;

1/DECODE('0',0,'100')


                  .01

> > any help, will get me started.
>
> > thanks
>
> the first thing you need to type is:
>
> SELECT
>
> Now really, the question is what have you tried?
>  Exactly what knowledge of SQL do you have?
>  (I have seen a SQL for Dummies book,
>  I've actually opened a SQL for Dummies book,
>  I have read a SQL for Dummies book,
>  I have seen the Oracle web page,
>  I have seen the Oracle SQL web pages,
>  I have read some of the Oracle SQL web pages, ...)

LOL! Oracle Purity test!

>
> We do not have the time or space to give a course in SQL in the
> newsgroup. Help us help you.
>
> Ed

jg

--
_at_home.com is bogus.
http://www.bofh.net/sl_Purity.html
Received on Mon Jul 20 2009 - 13:47:42 CDT

Original text of this message