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: 1537
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 Changeman get multiple "Browse C... elixir1986 Compuware & Other Tools 4 Fri Jul 14, 2017 1:48 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm


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