470,631 Members | 2,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

IBM DB2 question - Update 2 different tables based on IF THEN ELSE criteria

I was trying to post this to the IBM DB2 forum, however I do not have the "New Post" button available when I view the IBM DB2 forum. Therefore, I apologize if this is not the right place for this.

I need some help writing a single IBM DB2 v8 SQL statement to do an UPDATE, please. I need to be able to UPDATE 2 different tables based on some criteria without writing a stored procedure. I am trying to do an UPDATE such that IF some criteria on table X EXISTS THEN UPDATE table X ELSE UPDATE table Y.

I have searched extensively on thescripts.com and google and looked through IBM's documentation and haven't been able to find out if either 1.this is possible or 2.a good explicit example.

Any help with this would be greatly appreciated.

Oct 17 '06 #1
1 4942
have you tried using the merge statement.....if matched update table a else update table b
Nov 24 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by Philip Boonzaaier | last post: by
4 posts views Thread by Jeremy | last post: by
9 posts views Thread by Mahesh S | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.