Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

update multiple rows in DB2 query

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

New User


Joined: 12 Feb 2013
Posts: 2
Location: India

PostPosted: Tue Feb 12, 2013 6:32 pm    Post subject: update multiple rows in DB2 query
Reply with quote

Hi I'm currently using the query as
EXEC SQL
UPDATE table name
SET ACTION_TIMESTAMP = CURRENT TIMESTAMP
, AUDIT_ID = :Table-AUDIT-ID
WHERE SRC__NBR = :table-SRC--NBR

The value :table-SRC-IDENT-NBR is from a file.
Now its updating one row at a time. Is there any way to update multiple rows simultaneously.
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1534
Location: Andromeda Galaxy

PostPosted: Tue Feb 12, 2013 6:51 pm    Post subject:
Reply with quote

If your tables field SRC_NBR going to have only one value then you dont need to check for ':table-SRC--NBR'

There is no other option of updating multiple rows unless you set up the code to have a setup for Mutli row update like having IN or passing the data to array and have them as Host variables

Or Is the requirement to update the current timestamp for all the valid where clauses?
Back to top
View user's profile Send private message
ZIMI SAHOO

New User


Joined: 12 Feb 2013
Posts: 2
Location: India

PostPosted: Tue Feb 12, 2013 6:58 pm    Post subject:
Reply with quote

No its not just time stamp there are many field I'm updating.
Could you please tell me how to pass the data to array and have them as Host variable. I've no idea.
Thanks! icon_smile.gif
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Wed Feb 13, 2013 10:26 am    Post subject:
Reply with quote

Sonali,

Look at Merge Statement and here is the example.

Thanks,
Sushanth
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 Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts Unable to catalog a gdg dataset resid... Shovan JCL & VSAM 7 Fri Mar 24, 2017 2:24 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us