CREATE OR REPLACE procedure Test1
as
begin
--set transaction read write;
insert into aaa values(1);
commit;
end;
/
CREATE OR REPLACE procedure Test2
as
begin
--set transaction read write;
insert into aaa values(2);
Test1;
insert into aaa values(3);
rollback;
end;
運行結果aaa有兩個值1和2
自制事務的結果
CREATE OR REPLACE procedure Test1
as
PRAGMA AUTONOMOUS_TRANSACTION;
begin
--set transaction read write;
insert into aaa values(1);
commit;
end;
/
CREATE OR REPLACE procedure Test2
as
PRAGMA AUTONOMOUS_TRANSACTION;
begin
--set transaction read write;
insert into aaa values(2);
Test1;
insert into aaa values(3);
rollback;
end;
aaa中只有一個值1