title: How to use CASE/WHEN in DB2 by using insert in a stored procedure?
body: <p>I have a stored procedure for DB2, where I want to fill a field named SEASON with W for Winter and S for Summer. The procedure is done, but I can't handle the logic. Can someone show me how this works?</p>
  
  <p>This is for a dimension table in a data warehouse. </p>
  
  <p><code>INSERT into ABC.TIME_DIMEMSION (
      DATE,
      SEASON,
      QUERTER)
      VALUES(
      DATE(myDate),
      CASE
        WHEN MONTH(myDate) = 1 THEN
               SET SEASON= 'W';
        WHEN MONTH(myDate) = 2 THEN
               SET SEASON= 'W';
        WHEN MONTH(myDate) = 2 THEN
               SET SEASON= 'S';
        ELSE
               SET SEASON= 'X';
        END CASE.
        QUARTER(loaddate));
  </code></p>
  
  <p>I'm getting an error</p>