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
 
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: 1542
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm

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