Re: exception handling and CONTINUE
| От | Alvaro Herrera |
|---|---|
| Тема | Re: exception handling and CONTINUE |
| Дата | |
| Msg-id | 20080708130629.GA4095@alvh.no-ip.org обсуждение исходный текст |
| Ответ на | exception handling and CONTINUE ("Marcin Krawczyk" <jankes.mk@gmail.com>) |
| Ответы |
Re: exception handling and CONTINUE
|
| Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: