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: IIF IN ORACLE

Re: IIF IN ORACLE

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 8 May 2006 10:13:21 -0700
Message-ID: <1147108401.350715.285210@y43g2000cwc.googlegroups.com>


Besides Volker's reference to the CASE statement there is also the older DECODE function. Both CASE and DECODE can be used in the SELECT list and in the WHERE cause. You should probably choose to use CASE instead of DECODE but older code will have decode in it.

where values for fld1 are 1, 2, and 3.

  1* select decode(fld2,1,'ONE',2,'TWO','UNKNOWN') from marktest UT1 > /

DECODE(



ONE
TWO
UNKNOWN You can nest both CASE and DECODE statements. See the SQL Manual.

HTH -- Mark D Powell -- Received on Mon May 08 2006 - 12:13:21 CDT

Original text of this message

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