在自治事务里面commit或者rollback不会影响外部事务,可以做到单独成功,单独失败。在实际应用里面可以多多使用,提高开发效率。贴一个例子:
autonomous_transaction
create table t (msg varchar2(25));
--自治提交
create or replace procedure Autonomous_Insert
as
pragma autonomous_transaction;
begin
insert into t values ('Autonomous Insert');
commit;
end;
--正常的nonautonomous_insert过程
create or replace procedure NonAutonomous_Insert
as
begin
insert into t values ('NonAutonomous Insert');
commit;
end;
--匿名块中非自治事务的行为
begin
insert into t values ('Autonomous Block');
NonAutonomous_Insert;--调用NonAutonomous_Insert过程
rollback;
end;
select * from t;
1 Autonomous Block
2 NonAutonomous Insert
--匿名块执行的插入由NonAutonomous_Insert过程提交。这两个数据行都已提交,所以rollback命令没有什么可以回滚。把该过程与自治事务过程的行为进行比较
delete from t;
commit;
begin
insert into t values ('Autonomous Block');
Autonomous_Insert;--调用Autonomous_Insert过程
rollback;
end;
select * from t;
1 Autonomous Insert
---end
另外,有一位网友写的,可以去看看:
http://hwhuang.iteye.com/blog/650903
分享到:
相关推荐
Oracle自治事务的介绍(Autonomous_Transactions)PRAGMA_AUTONOMOUS_TRANSACTION
在触发器中使用自制事务及调用存储过程 Declare Pragma Autonomous_Transaction; ...
要创建一个自治事务,您必须在匿名块的最高层或者存储过程、函数、数据包或触发的定义部分中,使用PL/SQL中的PRAGMA AUTONOMOUS_TRANSACTION语句。在这样的模块或过程中执行的SQL Server语句都是自治的。
oracle 触发器 调用 存储过程 Oracle自治事务(Autonomous Transaction)
Oracle Autonomous Data Warehouse(ADW)操作手册,手把手搭建Oracle云上自助数据仓库
Oracle LiveLab实验“Boost Database Performance with Oracle Auto Partitioning”中的自动分区报告。
Seata:Simple Extensible Autonomous Transaction Architecture,简易可扩展的自治式分布式事务管理框架,其前身是fescar。阿里巴巴GTS的开源版实现,是一种分布式事务的解决方案,详情请参看seata官方文档。 seata...
Oracle10g中context类型的全文索引也...sync(on commit) 是采用的子事务autonomous transaction ; sync(every ..) 是利用的SCHEDULER 代码如下:SQL> create index MY_INDEX on t(object_name) indextype is ctxsys.
TableAdapter Configuration Wizard and Entity Designer and also includes many useful Oracle specific tools including an Oracle Cloud explorer allowing you to easily connect to and manage your ...
Introduction to Autonomous Mobile Robots.pdf
Autonomous Ground Vehicles
这是一个autonomous多媒体平时做的小例子
The new edition covers calls to Java methods from within PL/SQL programs, autonomous transactions, object type inheritance, and the new Timestamp and XMLType data types. There’s also more ...
Introduction to Autonomous Mobile Robots( 麻省理工)
Game Hacking Developing Autonomous Bots for Online Games 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自...
快速学习函数创建和练习。 创建函数、存储过程、创建过程、调用存储过程、AUTHID、PRAGMA AUTONOMOUS_TRANSACTION、开发存储过程步骤、删除过程和函数、过程与函数的比较
Introduction to Autonomous Mobile Robots,中文清晰版,经典的机器人学习书籍
Mobileye-Towards Autonomous Driving
Falcone Nonlinear Model Predictive Control for Autonomous Vehicles.rar