Oracle :Batch updates using PLSQL Blocks.

Share via:

Oracle :Batch updates using PLSQL Blocks.

In this article , we will learn how to update million records in a table using plsql blocks.

Aim : To avoid Undo errors

–> For every 200 transactions we are keeping commit to avoid snapshot too old error.

–> To avoid locks on table.

Please check below video link :

Example :

Step 1 :

Create tables structure as below

Step 2 :

Check each table structure

Step 3 :

Insert records into TABLE_REC_CA_7MAR using block.

Count the records TABLE_REC_CA_7MAR

Step 4 :

Insert test data into actual table TABLE_CA_UPDATION (1 million).

Count the records

Step 5 :

insert dummy record into TABLE_TAR(Tracking table)

Step 6 :

Script

The above script will execute and commits for every 200 transactions.

Example for 1 CPU 10000 records update :

Example for 1 CPU 100000 records update :

Example for 1 CPU 30000 records update :

 

Example for 1 CPU 30000 records update :

Please Use Validations while script executing.

Thank you …..

 

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Add Comment