postgresql - 保存点和回滚在 postgresql 脚本中不起作用
问题描述
我在下面的 pg 脚本中使用保存点和回滚。低于错误。
错误:PL/pgSQL 中不支持的事务命令
请帮助我如何实现这一目标。
do
$block$
declare
BEGIN
perform updatecustdtls (
custdes => 'initial state',
custno => 'C1122',
cmd => TO_TIMESTAMP('11/21/2005','dd/mm/yyyy')::TIMESTAMP(0),
);
savepoint updatecust;
update custd set custid = 9 where custno = 'C1122';
perform updatecustdtls (
custdes => 'middle state',
custno => 'C4455',
cmd => TO_TIMESTAMP('11/11/2006','dd/mm/yyyy')::TIMESTAMP(0),
);
rollback to updatecust;
perform updatecustdtls (
custdes => 'final state',
custno => 'C88809',
cmd => TO_TIMESTAMP('08/15/2007','dd/mm/yyyy')::TIMESTAMP(0),
);
end $block$;
提前致谢。
解决方案
推荐阅读
- algorithm - 使用广度优先搜索而不是双向搜索?
- python - 向 Django 中的总函数添加税金
- express - 设置具有多个目标的代理服务器?
- python - Python 3.8 的点子
- spring-boot - 使用SendToDlqAndContinue spring kafka流活页夹的序列化异常
- react-native - React-Native-Firebase:发生网络错误(如超时、连接中断或主机无法访问)
- python - 带有 Django 功能的 HTML 按钮 onclick 操作
- css - 打字机效果布局不是内联的
- c++ - 何时使用函数完全特化而不是重载
- php - 如何在 mysql 中存储可编辑的定义常量 web 设置