Bulk update for every 10k rown among 2L

5 pts.
Tags:
Oracle
Oracle Database
Scripting
Hi , Have a table in which 2lakh rows are present.I need to update a column and for every 10K i need a commit. Plese help me to write a script for this

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Meandyou
    You really didn't give much info in your question. Here is a short generic discussion. If you write one update statement all rows will be updated before the commit. Using Oracle PL/SQL or SQL/PLUS or another language you could use a cursor to identify the rows you want to update, and then issue an update for each row in the cursor, count them, at 10,000 issue a commit, and return to the update process. Using one update statement will cause lots of locks, but should run faster. Using the cursor will be much slower, but should provide better concurrency.
    5,220 pointsBadges:
    report
  • Dmcdconsult
    More info is definitely necessary. even if you decide to commit every 10K, there are a few ways to do it depending on your situation. A great article about this can be found on AskTom: http://www.oracle.com/oramag/oracle/01-jul/o41asktom.html# I find the following works best for me most of the time: declare v_count := 0; cursor (....) begin for r in cursor loop v_count:= v_count + 1; update rec; if ( v_count= 1000 ) then commit; v_count:= 0; end if; end loop; end;
    40 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following