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
 

 

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: 6966
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 IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts what is meaning of the number in dcl Martylin PL/I & Assembler 2 Thu Mar 09, 2017 7:18 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts GDG version number PANDU1 JCL & VSAM 4 Sat Mar 04, 2017 8:28 pm


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