Re: DECODE or else, a little test...

From: Gordon E. Hooker <gordonh_at_thehub.com.au>
Date: 1996/11/13
Message-ID: <328c41d0.1389657_at_news.thehub.com.au>#1/1


lesliet_at_u.washington.edu (L. Tseng) wrote:

>DECODE() is probably the most powerful function in Oracle.
>
>For example
>
>
> IF colA = 1 AND colB = 1 THEN 'YES'
> ELSE 'NO'
>
>can be converted as
>
> DECODE(colA, 1, DECODE(colB, 1, 'YES', 'NO'), 'NO')
>
>BUT.....
>
>Can DECODE do the following?
>
> IF colA > 100 THEN 'A'
> ELSIF colA = 100 THEN 'B'
> ELSE 'C'
I really can't understand why you have posted this question - because it would be simple enough to test on your own site.

If you read the SQL Language Reference Manual (3-63) you will see under usage notes that

'An expression is a combination of one or more values, operators, and SQL functions that evaluates to a value...'

colA > 100 is a relational operator and that evaluates to either true, false or null.

Does that answer your question...

>
>Thanks,
>
>Leslie
>
>
>

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ Gordon E. Hooker MACS PCP
25 Clarke Street Ripley Queensland Australia Phone 61-7-32940555
Email gordonh_at_thehub.com.au
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ We are just two lost souls living in a fish bowl Year after year

Pink Floyd Received on Wed Nov 13 1996 - 00:00:00 CET

Original text of this message