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
 
Any easier way to do update for more number of rows?

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

New User


Joined: 17 Feb 2009
Posts: 32
Location: Bangalore

PostPosted: Wed Jun 17, 2009 8:10 pm    Post subject: Any easier way to do update for more number of rows?
Reply with quote

Hi,

A new coloumn is introuced in a table, for which i have to load the default value. There are more than 1 lakh rows in table for which i have update the new column with the defaule value.


To achieve this update i understood, without giving where clause the query runs faster. But after 10,000 reocrds or so its getting rolled back since no commit statement was there. Do we have any other utility or way to do that?

Dynamically preparing a query for each and every row is also possible but i dnt knw about the effectivness of that!

--------------------------------------------------------------------------------
My query is just to update a particular coloumn with default value.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jun 17, 2009 8:41 pm    Post subject:
Reply with quote

The default value should have been specified when the column was added to the table.
Back to top
View user's profile Send private message
Sriram K

New User


Joined: 17 Feb 2009
Posts: 32
Location: Bangalore

PostPosted: Wed Jun 17, 2009 8:44 pm    Post subject:
Reply with quote

The default value will keep changing after every six months as per our requirement. Hence we haven't defined the table with default value.

So we planned to run an update for those?

Any utility or any other way it can be achieved?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Wed Jun 17, 2009 9:27 pm    Post subject:
Reply with quote

either
  • update thru a cursor and dedicate a weekend to running the job
  • dump the table and generate the current default value with your dump SQL and then reload the table.

Since you have to modify modules performing an INSERT,
you could obtain the 'current default value' from a control table.

I believe Default Values are those that DB2 uses when there is no value provided by the INSERT SQL.
Thus, if you have a value for the column, db2 will use that and not the DEFAULT Value.
I think y'all mis-interpreted the actions taken by db2 for a DEFAULT Value.
You should have used the DEFAULT VALUE clause in the ALTER statement.
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 Conversion of DLI update Jobs as BMP ... Gopinath Shanmugam IMS DB/DC 3 Wed Dec 20, 2017 12:02 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm

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