说明
如果不设置回滚点,如果回滚,直接回滚到事务开始前,有时我们只需要回滚到中间的某个位置,就可以设置回滚点
语法
| 回滚点的操作语句 | 语句 |
|---|---|
| 设置回滚点 | savepoint 名字 |
| 回到回滚点 | rollback to 名字 |
例子
-- 开启事务start transaction;-- 让a用户先减100update account set money = money - 100 where name = 'a';-- 设置回滚点savepoint itcast;-- 让a用户再次减100update account set money = money - 100 where name = 'a';-- 回到回滚点rollback to itcast;-- 提交事务commit;
