SQLScript 现在支持事务性保存点,允许将事务回退到定义的点。其中包括:
SAVEPOINT 的定义:SAVEPOINT SAVEPOINT: ROLLBACK TO SAVEPOINT SAVEPOINT 的释放:RELEASE SAVEPOINT SAVEPOINT 是事务性语句,例如 COMMIT 或 ROLLBACK。因此,事务语句的限制也适用于 SAVEPOINT。
drop table t1;
create table t1( i1 int );
create or replace procedure test
as begin
insert into t1 values(1);
SAVEPOINT save1;
insert into t1 values(2);
ROLLBACK TO SAVEPOINT save1;
select * from t1;
RELEASE SAVEPOINT save1;
end;
call test; -- result: {1}
select * from t1; -- result: {1}