Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    155

    Unanswered: more than 1 when expressions

    Hallo everyone,

    I am dealing with this line:

    Code:
    CASE 
    WHEN column_0='A' AND column_1='%C' THEN SET othercolumn='y' END
    It seems that I am not allowed to use AND in the WHEN-Clause. The manual doesnt give my any choice to implement more than one expressions for a when clause. Thank you for your help.

    Regards,
    Ratna

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    platform ? version ?
    complete sql ?
    complete message ?
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    May 2009
    Posts
    508
    Provided Answers: 1
    ratnalein, DB2 is expecting an expression after the THEN and not a statement. Try this instead:
    Code:
    SET othercolumn = CASE
                        WHEN     COLUMN_0 = 'A'
                             AND COLUMN_1 = '%C' THEN 'y'
                      END

Posting Permissions

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