IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

update multiple rows in DB2 query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Tue Feb 12, 2013 6:51 pm
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
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: 1020
Location: India

PostPosted: Wed Feb 13, 2013 10:26 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts RC query -Time column CA Products 3
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top