Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Location
    hyderabad
    Posts
    10

    Unanswered: alternative for decode

    hi all,

    what is alternative for decode(oracle) in db2

    bye
    ramakrishna

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Please explain what it does.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    Is this not the same as recursion? Search this forum for many examples!

  4. #4
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    Is this not the same as recursion? Search this forum for many examples!
    Scratch that... you want to use a CASE statement:
    Code:
    case field when value then newValue else otherValue end

  5. #5
    Join Date
    Jan 2004
    Location
    Tallahassee, FL, USA
    Posts
    96
    Originally posted by Damian Ibbotson
    Scratch that... you want to use a CASE statement:
    Code:
    case field when value then newValue else otherValue end


    case .. when is same as decode , but more powerfull than decode.


    select emp_id ,
    case job when 'PM' then 'Project Manager'
    when 'DB' then 'DBA'
    when 'PG' then 'Programmer'
    else ' Data entry'
    end as job_title
    from emp;

Posting Permissions

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