Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Bulk insert/delete

Bulk insert/delete

From: GL <georlevin_at_aim.com>
Date: 30 May 2006 07:10:54 -0700
Message-ID: <1148998254.336115.259570@i40g2000cwc.googlegroups.com>


Hello everybody! Thanks for your help in advance. I have some question. I need to "clean-up" a history data and there is lots of data. for example: table1 has 80 millions records. I now what records i need to keep( about 2 millions based on certain date ranges and some calculations)-rest of this should be deleted. What i'm trying to do is:



OPEN c_cursor1;---- what to keep
execute immediate 'delete from table1 where ....'; loop

   FETCH c_cursor1 BULK COLLECT INTO tbl_test LIMIT 1000;    FORALL indx IN tbl_test.FIRST .. tbl_test.LAST

          INSERT INTO table1
          VALUES tbl_test(indx);

   EXIT WHEN c_cursor1%NOTFOUND;
END LOOP;
   CLOSE c_cursor1
   COMMIT;

the problem is it takes too long and not always completed. if i'm not using LIMIT- memory problem.
Is anyone knows how it can be done better? Thanks Received on Tue May 30 2006 - 09:10:54 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US