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

From: Slava Natapov <Slava_Natapov_at_mail.stil.scitex.com>
Date: 1996/11/13
Message-ID: <328A70BE.41D3_at_mail.stil.scitex.com>#1/1


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'
>
> Thanks,
>
> Leslie
>

Other powerful function is SIGN...
Look at this:

 DECODE(SIGN(colA-100),1,'A',0,'B','C')

Slava Received on Wed Nov 13 1996 - 00:00:00 CET

Original text of this message