Re: How to insert in a table the error returns by query

Поиск
Список
Период
Сортировка
От ciamblex
Тема Re: How to insert in a table the error returns by query
Дата
Msg-id 1422467392779-5835817.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: How to insert in a table the error returns by query
Re: How to insert in a table the error returns by query
Список pgsql-sql
Thank you David fot your replay.

I have an other question.

How can i rollback ALL the query when one of these return an error?

My code is like the following:

------------------------------------
BEGIN

INSERT INTO table_1 ....

INSERT INTO table_2 ....

INSERT INTO table_3 ....

EXCEPTION WHEN others THEN code:=SQLSTATE;    mess:=SQLERRM;    
es:=code||'|'||mess;


RETURN es;

END;
------------------------------------

In this case when an error occurs the rollback work only on the wrong query.
The other insert are committed.

Thank you!



--
View this message in context:
http://postgresql.nabble.com/How-to-insert-in-a-table-the-error-returns-by-query-tp5835771p5835817.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



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

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: How to insert in a table the error returns by query
Следующее
От: David G Johnston
Дата:
Сообщение: Re: How to insert in a table the error returns by query