By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,236 Members | 1,355 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,236 IT Pros & Developers. It's quick & easy.

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

P: 1
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 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
Share this Question
Share on Google+
1 Reply

P: 13
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.