Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: DECODE OR CASE

Re: DECODE OR CASE

From: Anon-o-mouse <Anonomouse_at_notmail.com>
Date: Sat, 03 Jul 2004 10:38:18 GMT
Message-ID: <4fvce0ljlc27c38t4m7gnep5vvebpr5lve@4ax.com>


On Fri, 2 Jul 2004 11:41:05 +0500, "Oracle Newbie" <f93c0532_at_yahoo.com> wrote:

>How is it possible to use the DECODE function or CASE statement to implement
>some thing like this
>

...
case / decode will both work ....
(depends on which version of the DB you wish to run on and your performance requirements .. )

Case is *MUCH* easier to read & to maintain.

If you wish to use decode - then you will need to use the greatest or least functionality
ie decode(greatest(salary,1200), salary,

                             decode(greatest(salary,1500), salary,

...
                                       )
                            , 0
         )

see the oracle SQL manual .... DECODE , GREATEST, LEAST

For the CASE expression I suggest you see the oracle sql manual in particular the "Simple CASE Example" and the "Searched CASE Example". There are very simple examples there. Received on Sat Jul 03 2004 - 05:38:18 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US