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

i have 2 millions records in DB2 table, i want to UPDATE


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
soumyaranjan007

New User


Joined: 30 Aug 2006
Posts: 30
Location: mumbai

PostPosted: Tue Nov 07, 2006 11:43 am
Reply with quote

Hi Gurues,


I have 2 millions record in one DB2 Table. i want to update those 2 millions records. could any body pass the queries for that.

we have tried with

UPDATE <TABLE NAME> SET <column name> = '35';


But this queries got abend due to full of buffer space.


Could any body aware of this issue, please help me out to sort out issue
ASAP.

Regards
Somu
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Nov 07, 2006 1:15 pm
Reply with quote

Hi soumyaranjan007,

Another option is download the table in to flat file update value for that coloum & again load it in to table.
Back to top
View user's profile Send private message
soumyaranjan007

New User


Joined: 30 Aug 2006
Posts: 30
Location: mumbai

PostPosted: Tue Nov 07, 2006 6:08 pm
Reply with quote

Hi Ekta,


Actually we are planning to modify the table structure ( one new column will be add). we want to update that column for older data.

I really appreciate your view but uploading the data from table and load back to table after modifying data is not a fusible way for ous because of authority restrictions.

But we are able to solve this issue.

I am highlighting that steps need to take care before update the huge data below.

1. We lock the table in EXCLUSIVE mode first.
2. Update the column

Regards
Somu
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Nov 07, 2006 6:46 pm
Reply with quote

that many rows... I suggest either:
    [
  • update current cursor, with COMMITs every 1000 rows or so
  • if you must spufi, then multiple UPDATEs where <condition-1>AND<condition-2>
    • condition 1 = range of unique key
    • condition-2 = <column Not Equal '35'>

a MASS UPDATE means that you are sucking the complete table into a recovery copy; you are duplicating the table in DB2's work space. You have to update sections (rows), then commit those rows, then UPDATE some more.
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Fri Nov 10, 2006 2:43 am
Reply with quote

Yes. Frequent commit will help in this case.
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Fri Nov 10, 2006 2:47 am
Reply with quote

Also you can use "for update of" in the cursor and "where current of" in the update"...if exclusive control of the table is not a problem.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top