Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Delete table data from procedure in batch of 10,000 per execution.

VJ4Jan 14 2011 — edited Jan 17 2011
Hello ,
I have ORACLE 11g & RHLE 5

I have a procedure which generates a dynamic delete statement and then gets executed and deleted the duplicated data present in the table.

Now the problem is that one of my table consist 30 Lacs + records and when it takes this much amount of data in temporary tablespace for sorting and deleting the data then the TEMP tablespace is not able to handle this situation , as already the temp tablespace is near to full..

Can i modify this code in a format that it should take only 10,000 rows at a time for deletion operation and then the next 10,000 and so on ...
IF P_IN_DIM1='Y' THEN                       
	        V_TABLE_NAME:=P_IN_TABLE_NAME||'_1D';              
       
V_QRY := ' DELETE FROM '||TABLE_NAME||' A WHERE A.DATE_TIME < (SELECT MAX(B.DATE_TIME) FROM ' ||V_TABLE_NAME||' B WHERE '||V_FIELD||' AND A.IDX1 = B.IDX1)';                                                                              
                                                                                           
            EXECUTE IMMEDIATE V_QRY;                                                                         
      END IF;
Thanks in advance ....
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 14 2011
Added on Jan 14 2011
14 comments
1,053 views