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: 6968
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Profile changed to NUMBER ON STD (fro... Martylin TSO/ISPF 1 Thu Aug 03, 2017 9:14 am

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