3.4.3 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax
3.4.3.1 Syntax
语法与MySQL完全相同
SAVEPOINT identifier
ROLLBACK [WORK] TO [SAVEPOINT] identifier
RELEASE SAVEPOINT identifier
3.4.2.2 与MySQL语法区别
下文中红色表示不支持的语法或关键字
3.4.3.2 举例
# start transaction
set autocommit = 0;
# savepoint
savepoint s0;
insert into test value(1);
savepoint s1;
insert into test value(2);
savepoint s2;
insert into test value(3);
# rollback to
rollback to s0
# release
release savepoint s0
3.4.3.3 限制
- 在mysql中,在事务外也可以定义savepoint,但是这些savepoint是没有意义的.因此在dble中savepoint强制在事务中使用,否则报错.
- ROLLBACK TO [SAVEPOINT] identifier 语句暂不支持 work 可选项.