create or replace procedure test_proc as begin insert into a...; savepoint a; insert into b...; savepoint b; rollback to a; insert into c....; savepoint c; ..... end; 我觉得没什么特别的阿,有什么问题吗?
不是,是这样: insert into a...; savepoint a; insert into b...; savepoint b; insert into c....; savepoint c; 这时候我想rollback a和b之间的操作. 要是rollback to a是不是把c也rollback了?
用Autonomous Transactions如uje(sky) 所说 具体的用法参见8i pl/sql user guide 大概意思如下 create or replace procedure test_mt as begin insert a ... savepoint a insert b... savepoint b test_at; rollback to a; ... end; create or replace procedure test_at as PRAGMA AUTONOMOUS_TRANSACTION; begin insert c... ..... end;
I will try later! Thank everyone very much! Especially flowerofwind(现实很残酷)! By the way, the csdn.net is too bad!
begin
insert into a...;
savepoint a;
insert into b...;
savepoint b;
rollback to a;
insert into c....;
savepoint c;
.....
end;
我觉得没什么特别的阿,有什么问题吗?
insert into a...;
savepoint a;
insert into b...;
savepoint b;
insert into c....;
savepoint c;
这时候我想rollback a和b之间的操作.
要是rollback to a是不是把c也rollback了?
具体的用法参见8i pl/sql user guide
大概意思如下
create or replace procedure test_mt as
begin
insert a ...
savepoint a
insert b...
savepoint b
test_at;
rollback to a;
...
end;
create or replace procedure test_at as
PRAGMA AUTONOMOUS_TRANSACTION;
begin
insert c...
.....
end;
Thank everyone very much! Especially flowerofwind(现实很残酷)!
By the way, the csdn.net is too bad!