[已解决]PostgreSQL报错:cannot begin/end transactions in PL/pgSQL解决方法
PostgreSQL报错:cannot begin/end transactions in PL/pgSQL解决方法
出现此问题一般都是代码格式错误,或者代码块中出现了PostgreSQL中不应该出现的语法,语法错误。
ERROR: cannot begin/end transactions in PL/pgSQL
HINT: Use a BEGIN block with an EXCEPTION clause instead.
CONTEXT: PL/pgSQL function “fun_td_xxx_xxx_result” line 845 at SQL statement
********** 错误 **********
ERROR: cannot begin/end transactions in PL/pgSQL
SQL 状态: 0A000
指导建议:Use a BEGIN block with an EXCEPTION clause instead.
上下文:PL/pgSQL function “fun_td_xxx_xxx_result” line 845 at SQL statement
经过仔细检查,发现是我在845行中使用delete语句后用了commit;语句,删除该语句,问题解决了
from: http://www.aiphere.com/postgresql-cannot-begin-end-transactions-in-plpgsql.html