Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update using where clause 1

Status
Not open for further replies.

anniez

IS-IT--Management
Apr 13, 2001
43
US
Can you help me write the update statement:

UPDATE TABLE1
SET FIELD1=:NEW.FIELD1,
FIELD2=:NEW.FIELD2,
WHERE TABLE1.EMPID=:NEW.EMPID

to also update table1.curstat to 1 if :new.reason=2,
table1.curstat to 2 if :new.reason=4,
table1.curstat to 3 if :new.reason is null

I can't seem to get the right syntax. Thanks
 
You may use DECODE function:

update table1 set curstat decode:)new.reason,2,1,4,2,null,3)
Regards, Dima
 
Is there a way to give this response 10 red stars?
Thank you so much -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top