数据仓库服务 GAUSSDB(DWS)-ROLLBACK TO SAVEPOINT:示例

时间:2024-01-26 16:15:24

示例

撤销 my_savepoint 建立之后执行的命令的影响:

1
ROLLBACK TO SAVEPOINT my_savepoint;

游标位置不受保存点回滚的影响:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
BEGIN;
DECLARE foo CURSOR FOR SELECT 1 UNION SELECT 2;
SAVEPOINT foo;
FETCH 1 FROM foo;
 ?column? 
----------
        1
ROLLBACK TO SAVEPOINT foo;
FETCH 1 FROM foo;
 ?column? 
----------
        2
COMMIT;
support.huaweicloud.com/sqlreference-820-dws/dws_06_0269.html