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 this:
for a in select * from xxx
loop begin insert into yyy values (...) exception when unique_violation then null; -- noop, just for clarity
end;
end loop;
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support