DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Decode statement

Threaded View

  1. #2
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    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
    Last edited by Shestakov; 11-18-2002 at 04:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width