Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can I update two Tables in a Single Query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ankvardhan

New User


Joined: 05 Sep 2008
Posts: 14
Location: Mumbai

PostPosted: Wed Feb 18, 2009 2:32 pm    Post subject: Can I update two Tables in a Single Query
Reply with quote

Hi,

My Question is, if i have two tables say: Table1 & Table2 and b/w both the tables there is a Refrential Integrity is maintained.
So is it posible to Update both the Simultaneously,
I run the Query :
UPDATE TABLE1 TABLE2
SET DATE ='01/15/2009'
WHERE NAME = 'JC'

Please assist ...!!
Back to top
View user's profile Send private message

aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Wed Feb 18, 2009 2:36 pm    Post subject:
Reply with quote

Could you please tell me on which column the referential integrity is maintained. I don't think that you can update both tables simultaneously. Anyone please correct me if i am wrong.
Back to top
View user's profile Send private message
ankvardhan

New User


Joined: 05 Sep 2008
Posts: 14
Location: Mumbai

PostPosted: Wed Feb 18, 2009 2:45 pm    Post subject: Query
Reply with quote

Hi,

ok , lets there are columns Column1 (date) of table1 which is also present as Column2 (Date) in table2, i tried to update the above defined Columns with a single Query, but its giving me an Error of Ref. Integrity.

This means in a single query its not allowing me to Update the Date Column of both the Tables.
For this what should i have to do, whether run the Queries independently to Update it OR there is any other soution from your side.

Thanks,
Ank
Back to top
View user's profile Send private message
aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Wed Feb 18, 2009 2:50 pm    Post subject:
Reply with quote

Yes, you need to write two queries for updating two tables. But you should first see what check is there in referential integrity definition i.e. there are lot of options as UPDATE on CASCADE etc. so that child column would be updated on basis of parent referential column.
Back to top
View user's profile Send private message
ankvardhan

New User


Joined: 05 Sep 2008
Posts: 14
Location: Mumbai

PostPosted: Wed Feb 18, 2009 3:00 pm    Post subject:
Reply with quote

Thanks..
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed Feb 18, 2009 3:59 pm    Post subject:
Reply with quote

fyi ... There is no CASCADE for update .... only DELETE has a CASCADE option ... In your case there should not be any restriction on UPDATE ... update the two tables separately with 2 different queries ...
Back to top
View user's profile Send private message
aishwarya_20

New User


Joined: 19 Nov 2008
Posts: 57
Location: pune

PostPosted: Wed Feb 18, 2009 4:08 pm    Post subject:
Reply with quote

Thanks Ashimer, i was not sure...But Two queries are needed.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts More than 1 Include criteria for sing... Roy Ware SYNCSORT 6 Wed Sep 13, 2017 11:45 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us