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

From: AMARENDRA B NETTEM <nettama_at_charlie.cns.iit.edu>
Date: 1996/11/17
Message-ID: <328EB4C5.694B_at_charlie.cns.iit.edu>#1/1


Jared Still wrote:
>
> On Wed, 13 Nov 1996, Sridhar Subramaniam wrote:
>
> > 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
> > >
> > Leslie,
> >
> > try decode( sign( colA - 100 ), 1, 'A', 0, 'B' ).
> > --
> >
>
> Check out the comprehensive article on this in OTJ.
> ( Oracle Tech Journal )
>
> Jared Still
> DBA/SysAdmin
> ValueRx
> jared_at_psnw.com
> stillj_at_valuerx.com

You can use the second decode function. it works fine.

-- 
    AMARENDRA B NETTEM
    ORACLE CONSULTANT
    WHITTMAN-HART CORPORATION, CHICAGO
    (http://www.iit.edu/~nettama)
Received on Sun Nov 17 1996 - 00:00:00 CET

Original text of this message