Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle 8i SQL Statement
Originally posted by Kent Prokopy
> 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
Not with DECODE, no. But in 8i we have CASE:
CASE WHEN fieldname IN (1,2,3) THEN 'TRUE' ELSE 'FALSE' END
Note:
-- Posted via http://dbforums.comReceived on Fri Sep 19 2003 - 07:39:18 CDT