Example:
Code:ccreate table test_decode(a date, b number); insert into test_decode (a, b) values(trunc(sysdate-5),1); insert into test_decode (a, b) values(trunc(sysdate+5),2); insert into test_decode (a, b) values(to_date(null),3); SQL> select sysdate, a, b, decode(a,null,'X',decode(sign(a-sysdate),-1,'X','Y')) from test_decode; 2 SYSDATE A B D --------- --------- ---------- - 18-NOV-02 23-NOV-02 2 Y 18-NOV-02 3 X 18-NOV-02 13-NOV-02 1 X




Reply With Quote