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 -> Re: Bulk insert/delete

Re: Bulk insert/delete

From: lazycat <cao_liwei_at_hotmail.com>
Date: 30 May 2006 17:48:56 -0700
Message-ID: <1149036536.000252.70430@i39g2000cwa.googlegroups.com>

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

Original text of this message

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