Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: *DECODE* to implement IF condition???
<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