Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PL/SQL CASE in INSERT statement

AntillesSep 11 2008 — edited Sep 11 2008
I'm trying to insert a record into a table, changing the value of the field in the insert based on a condition. To simplify the code:
DECLARE

  true_or_false BOOLEAN;

BEGIN

  true_or_false := FALSE;
      
  INSERT INTO table1
  (column1)
  VALUES
  (CASE WHEN true_or_false = FALSE THEN 0 ELSE -1 END);
  
END;
This is something I can do in SQL Server but can't quite get the Oracle syntax right. Can anyone help me please?
This post has been answered by Nicolas Gasparotto on Sep 11 2008
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2008
Added on Sep 11 2008
3 comments
752 views