Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: DECODE is fine, but where is the IIF ?
Michael G. Schneider wrote:
>
> Beginner's question:
>
> I just learned about the DECODE function. Very good, but what I am missing
> is a way to not compare against certain values, but instead being able to
> code a boolean condition (something like an IIF an Visual Basic). For
> example the following:
>
> DECODE(x<y, TRUE, 'less', FALSE, 'greater')
>
> isn't possible. Or is it somehow?
>
> Michael G. Schneider
>
> mgs_software_at_compuserve.com
For the example stated you could
decode(least(x,y),x,'less',y,'greater')
There are many other functions available that
may make decode work for you.
However you may want to look at PL/SQL if you are more comfortable with 'if' statements etc.
Cheers,
Terry
Received on Mon Nov 03 1997 - 00:00:00 CST