PRAGMA AUTONOMOUS_TRANSACTION(自治事务)

例子

procedure p_inner_truncate is PRAGMA AUTONOMOUS_TRANSACTION;
begin
   execute immediate 'truncate table a';
   execute immediate 'truncate table b';
end;

第一,这段程序不依赖于原有Main程序,比如Main程序中有未提交的数据,那么在自治事务中是查找不到的。

第二,在自治事务中,commit或者rollback只会提交或回滚当前自治事务中的DML,不会影响到Main程序中的DML。

DML:数据操纵语言(Data Manipulation Language, DML):INSERT、UPDATE、DELETE......

转载:https://blog.csdn.net/pan_tian/article/details/7675800

猜你喜欢

转载自blog.csdn.net/a1085441210/article/details/82149441