Re: Catch exceptions outside function

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: Catch exceptions outside function
Дата
Msg-id A737B7A37273E048B164557ADEF4A58B17C21F41@ntex2010a.host.magwien.gv.at
обсуждение исходный текст
Ответ на Catch exceptions outside function  (Roberto Grandi <roberto.grandi@trovaprezzi.it>)
Ответы Re: Catch exceptions outside function
Список pgsql-admin
Roberto Grandi wrote:
> I ask for your help cause I can't point out the solution to my problem on PG 8.3
> I would catch an exception outside any function/procedure but directly within script.
> 
> 
> BEGIN;
> 
> -- raise an exception code
> 
> EXCEPTION
> WHEN 'exception_type'
> THEN ROLLBACK;
> 
> COMMIT;
> 
> is it possible with PG 8.3?

That's a bit unclear.
What do you mean by "outside a function but in a script"?
Can you explain in more detail?

The code sample you paste looks like PL/pgSQL.

You cannot commit or roll back in PL/pgSQL.

If you want to undo in case of error whatever happens in the block,
just replace the ROLLBACK with NOOP.

Yours,
Laurenz Albe

В списке pgsql-admin по дате отправления:

Предыдущее
От: Roberto Grandi
Дата:
Сообщение: Catch exceptions outside function
Следующее
От: Roberto Grandi
Дата:
Сообщение: Re: Catch exceptions outside function