Get id of a tuple using exception

Поиск
Список
Период
Сортировка
Искать
От
f vf
Тема
Get id of a tuple using exception
Дата
Msg-id
BANLkTik0fUKBcdYEnFeLczA0e6Gmt-3D=g@mail.gmail.com
Список
Дерево обсуждения
Re: Get id of a tuple using exception Jasen Betts <jasen@xnet.co.nz>
Hello,
i'm using a pl/sql procedure and I prevent inserting duplicate tuples using an exception for example:

  BEGIN
       INSERT INTO "Triples"(id, subject, predicate, "object")
                    VALUES (id, sub_i, pred_i, obj_i);
 EXCEPTION WHEN unique_violation THEN
                --do something.

In some cases I have interest in getting the id of the tuple that was already in the table when the exception is triggered. Is there a way for the EXCEPTION to return that id instead of using a select to know wich was the id of the triple already existing in the table?

Thanks,
Filipe
В списке pgsql-sql по дате отправления
От: Volkmar Herbst GCI
Дата:
Сообщение: strange update behavior
От: Adrian Klaver
Дата:
FAQ