Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 720 Bytes

File metadata and controls

36 lines (24 loc) · 720 Bytes

3.4.5 SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax

3.4.5.1 Syntax

SAVEPOINT identifier

ROLLBACK [WORK] TO [SAVEPOINT] identifier

RELEASE SAVEPOINT identifier

3.4.5.1 举例

# 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.5.2 限制

  1. 在mysql中,在事务外也可以定义savepoint,但是这些savepoint是没有意义的.因此在dble中savepoint强制在事务中使用,否则报错.
  2. ROLLBACK TO [SAVEPOINT] identifier 语句暂不支持 work 可选项.