create table AA ( id NUMBER, name VARCHAR2(3) ); insert into aa (id,name) values(1,'g1'); insert into aa (id,name) values(2,'g2'); select t.*, t.rowid from AA t; commit; -------------- insert into aa (id,name) values(3,'g3'); rollback; insert into aa (id,name) values (4, 'g4'); insert into aa (id,name) values (5, 'g5'); savepoint A; update aa set name='g9' where id=5; update aa set name='g10' where id=5; update aa set name='g11' where id=6; savepoint B; insert into aa (id,name) values (6, 'g6'); rollback to B; rollback to A; commit; --或者 rollback;
系统中有个队列,用savepoint对整个transaction的不同阶段进行标记,标记不会导致已有的命令执行。
这个过程中,如果想回滚,告知回滚到什么地方即可。
如果一条DML语句会造成多少影响,则使用sql$rowcount来看会有多少影响
https://www.cnblogs.com/langtianya/p/5067019.html