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

Any easier way to do update for more number of rows?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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: 6966
Location: porcelain throne

PostPosted: Wed Jun 17, 2009 9:27 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top