473,378 Members | 1,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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.

Thanks,
EFO
Oct 17 '06 #1
1 5087
Herb
13
have you tried using the merge statement.....if matched update table a else update table b
Nov 24 '06 #2

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

Similar topics

16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
3
by: Bob C. | last post by:
When I migrated my tables to SQL Server I needed a way to overcome the slow performance of the Find method on my recordsets. Although this can be done by accessing the table directly using dao and...
11
by: DFS | last post by:
Architecture: Access 2003 client, Oracle 9i repository, no Access security in place, ODBC linked tables. 100 or so users, in 3 or 4 groups (Oracle roles actually): Admins, Updaters and ReadOnly....
4
by: Jeremy | last post by:
My app is throwing an exception regarding trying to post a null to a required field. Examining the datarow in question, I see a valid date value. The row's state is "added" I'm relying on an ...
9
by: Mahesh S | last post by:
Hi I have to perform an update on a table. I am having problems figuring out how to join two tables as I need to check a value in a different table before performing the update. I have two...
2
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
6
by: PsyClone | last post by:
Im fairly new to access and would prefer not to use any scripting as such, but Im trying to create aselect query based on two tables: tblProduction, from which the query uses DeptID, ProductionQty, ...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
8
by: Fluffygoldfish | last post by:
Hi I am trying to tidy up an access database that has traditionally just been used as a spreadsheet. I have split up the information into different tables and need some help transferring...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.