Re: Continue on Exception

From: Paul Brooks <P.A.Brooks_at_btinternet.com>
Date: 1997/12/23
Message-ID: <349FB6E9.54A_at_btinternet.com>#1/1


Gnomic wrote:
>
> OK, must have missed it. I've RTFM'd on how to continue after an exception
> and can't find a decent example. I'm trying to do the following:
>
> for i in i_start..i_end loop
>
> insert into tbl (xx,yy) values (aa,bb);
>
> end loop
>
> exception
> when others -- like a duplicate record which I don't care about!
> continue
> end
>
> I don't want to read and then write if I can help it since it doubles my
> I/O. Can anyone point me towards an example? Thanks in advance.

To take your example, you can do the following :

for i in i_start..i_end
loop

   begin

      insert into tbl (xx,yy) values (aa,bb);    exception

      when dup_val_on_index then
         null;

   end;

end loop;

NOTE : it is not good practice to put a null statement into a WHEN OTHERS clause Received on Tue Dec 23 1997 - 00:00:00 CET

Original text of this message