[SQL] exception handling and CONTINUE

2008-07-08 Thread Marcin Krawczyk
Hi all. Can anyone tell me if there's a way to use CONTINUE clause outside the loop ? An example : FOR a IN SELECT * FROM xxx LOOP INSERT INTO yyy VALUES (a.***, ..) END LOOP; EXCEPTION WHEN unique_violation THEN CONTINUE; I get an error saying I can't use CONTINUE outside of a loop. Is there

Re: [SQL] exception handling and CONTINUE

2008-07-08 Thread Alvaro Herrera
Marcin Krawczyk escribió: > Hi all. Can anyone tell me if there's a way to use CONTINUE clause outside > the loop ? > An example : > > FOR a IN SELECT * FROM xxx > LOOP > > INSERT INTO yyy VALUES (a.***, ..) > > END LOOP; > > EXCEPTION WHEN unique_violation THEN CONTINUE; Try something like th

Re: [SQL] exception handling and CONTINUE

2008-07-08 Thread Pavel Stehule
no, you can use CONTINUE only in loop. When you wont ignore exception, just do nothing For example, the following two fragments of code are equivalent: BEGIN y := x / 0; EXCEPTION WHEN division_by_zero THEN NULL; -- ignore the error END; BEGIN

Re: [SQL] exception handling and CONTINUE

2008-07-08 Thread Marcin Krawczyk
Thank you guys. Alvaro your idea works tha way I wanted. Why didn't I think about it ? :) regards mk