Update using CASE statement - can't see it.
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Update using CASE statement - can't see it.

Hybrid View

  1. #1
    Join Date
    Dec 1999
    Location
    Purgatory
    Posts
    346

    Update using CASE statement - can't see it.

    Havin' a bad day.........

    What's wrong with this

    UPDATE PHILTEST SET TYPE =
    CASE DATE1
    WHEN '05-NOV-03' THEN 'CR'
    WHEN '01-DEC-03' THEN 'TN'
    WHEN '01-JAN-04' THEN 'RV'
    END CASE;
    END CASE
    *
    ERROR at line 6:
    ORA-00933: SQL command not properly ended

  2. #2
    Join Date
    Aug 2002
    Posts
    115
    UPDATE PHILTEST SET TYPE =
    CASE DATE1
    WHEN '05-NOV-03' THEN 'CR'
    WHEN '01-DEC-03' THEN 'TN'
    WHEN '01-JAN-04' THEN 'RV'
    END;

  3. #3
    Join Date
    Dec 1999
    Location
    Purgatory
    Posts
    346
    That did it. Only use 'END CASE' within a PL/SQL block... Thanks.

    The final solution....

    UPDATE PHILTEST SET TYPE =
    CASE to_char(DATE1,'DD-MON-YY')
    WHEN '05-NOV-03' THEN 'CR'
    WHEN '01-DEC-03' THEN 'TN'
    WHEN '01-JAN-04' THEN 'RV'
    ELSE TYPE
    end
    where to_char(date1,'DD-MON-YY')
    in ('05-NOV-03','01-DEC-03','01-JAN-04');

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