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: Oracle 8i SQL Statement

Re: Oracle 8i SQL Statement

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Fri, 19 Sep 2003 07:18:30 -0700
Message-ID: <1063981103.366549@yasure>


Kent Prokopy wrote:

>When using the DECODE function, is there any way of passing it the
>IN() clause?
>
>Example:
>DECODE(FIELDNAME,IN(1,2,3),TRUE,FALSE)
>
>This returnning TRUE if the values of 1, 2 or 3 are found. So far the
>only way I can get this to work is as follows:
>
>DECODE(FIELDNAME,1,TRUE,2,TRUE,3,TRUE,FALSE) "This leaving a lot of
>room for typo errors."
>
>Thank you.
>Kent Prokopy
>
>

What is it you expect as the output? True if it is any one of the three values presented?

If so use the CASE statement but you must do it in SQL*Plus, not a PL/SQL procedure, unless you do it as dynamic SQL. As of v9 you can do it in PL/SQL directly.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Fri Sep 19 2003 - 09:18:30 CDT

Original text of this message

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