Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Bulk insert/delete
waiting for anyone answer the question
GL wrote:
> 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 - 19:48:56 CDT
![]() |
![]() |