Nested case in DB2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rumana shaik
    New Member
    • Aug 2007
    • 2

    #1

    Nested case in DB2

    Hi all,

    I would like to know does DB2 supports nested case statement?

    If it supports then can u please tell me the syntax?
  • naval123
    New Member
    • Aug 2007
    • 14

    #2
    Originally posted by rumana shaik
    Hi all,

    I would like to know does DB2 supports nested case statement?

    If it supports then can u please tell me the syntax?

    HI

    Yes Db2 supports nested case statement. i am sending u a Update query
    via nested case.

    UPDATE STAFF

    SET COMM = CASE DEPT
    WHEN 15 THEN COMM * 1.1
    WHEN 20 THEN COMM * 1.2
    WHEN 38 THEN
    CASE
    WHEN YEARS < 5 THEN COMM * 1.3
    WHEN YEARS >= 5 THEN COMM * 1.4
    ELSE NULL
    END
    ELSE COMM
    END
    WHERE COMM IS NOT NULL
    AND DEPT < 50;

    Comment

    • Purple
      Recognized Expert Contributor
      • May 2007
      • 404

      #3
      Moved from Articles

      Moderator

      Comment

      Working...