Re: Optimizing a delete script

From: Gerard H. Pille <ghp_at_infosoft.be>
Date: 1996/03/02
Message-ID: <4h9lmn$323_at_news.Belgium.EU.net>#1/1


In article <3137549a.22599385_at_nntp.ix.netcom.com>, chuckh_at_ix.netcom.com says...
!>I think I've pretty much decided on the PL/SQL route anyway. Then I
!>have complete control over what happens when. Plus it seems to be
!>faster.
!>
!>for rec in parent_cursor loop
!> delete from child1 where childcol = rec.col;
!> delete from child2 where childcol = rec.col;
!> etc...
!> commit;
!>end loop;
!>--
!>Chuck Hamilton
!>chuckh_at_ix.netcom.com
!>
!>If at first you don't succeed, skydiving isn't for you.

Watch out for the commit in your loop. It'll reselect your parent query for each parent. May cost you! If you want to commit for each parent (it might be necessary) then have a:
loop
 select blablable from parent where xyz; /* select one parent */  exit when SQL%NOT_FOUND_or_something;

 delete from a ...
 delete from b ...
 delete from c ...
 delete parent ...

end loop; Received on Sat Mar 02 1996 - 00:00:00 CET

Original text of this message