【发布时间】:2015-06-03 22:15:55
【问题描述】:
我在 postgres 中或多或少地使用了类似的东西来模拟在 SQL Server 中我如何使用 Try/Catch 块以及在发现错误时可以在 Catch 中回滚的事务:
do $$
begin
[SQL here]
exception when others then
raise notice 'Error in insert statement ---> % %', SQLERRM, SQLSTATE LINE;
end;
$$ language 'plpgsql';
有没有办法报告发生错误的行,例如“ERROR_LINE()”?
提前致谢
【问题讨论】:
标签: postgresql error-handling plpgsql