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* to implement IF condition???

Re: *DECODE* to implement IF condition???

From: Richard Kuhler <noone_at_nowhere.com>
Date: Wed, 31 Oct 2001 16:38:42 GMT
Message-ID: <mOVD7.11291$D5.2923203@typhoon.san.rr.com>


<snip>

> On earlier versions of Oracle, this usually turns
> into a messy sequence of subtracting sysdate
> and decoding the sign() function applied to the
> result.

He's referring to something like this:

select decode(col4,
  'ABC', decode(sign(least(sysdate - date1, date2 - sysdate)),

     1, 'DEF YES', 'DEF NO'),
  'DEF', decode(sign(least(sysdate - date1, date2 - sysdate)),

     1, 'DEF YES', 'DEF NO'),
  'NEITHER ABC NOR DEF')
from t1

Richard Received on Wed Oct 31 2001 - 10:38:42 CST

Original text of this message

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