Simple DECODE usage
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Simple DECODE usage

  1. #1
    Join Date
    Sep 2000
    Location
    Chicago, IL
    Posts
    316

    Question

    I want to use the DECODE function to

    display the column value if it is not null, and if the column value is null then I want to print a string:

    select empno, empname, decode(empphone, from emp;

    HOW DO I DO THIS ?

    Thanks.

  2. #2
    Join Date
    Sep 2000
    Posts
    47

    select empno, empname, decode(empphone, null, 'Phone Is NULL', empphone) from emp ;


  3. #3
    Join Date
    Sep 2000
    Location
    Chicago, IL
    Posts
    316

    Thumbs up

    Thanks Pinakin,

    I just figured out that I can also use NVL to do the same thing.

  4. #4
    Join Date
    Aug 2000
    Posts
    462
    select nvl(fieldname,'Field is NULL!') from mytable;

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