Oracle自治事务
2013-08-20 13:20
274 查看
本文章来自http://hi.baidu.com/sqlercn/item/10f170c96fbbfad7964452b8
Oracle自治事务介绍
在正常情况下一但发出commit或是rollback语句就会把这之前的所有修改提交或回滚,但是在oracle中提供了一种自治事务,在自治事务中发出的commit或rollback语句只会对自治事务内的更改起做用而不会对自治事务外的修改起做用。可以通过以下例子来看到这一结果: 首先建立一个表Create table Msg (Msg varchar(50)) 用于存储消息 建立自治事务下的插入过程 Create or Replace procedure AutoNomouse_Insert as pragma autonomouse_transcation; begin insert into Msg values('AutoNomouse Insert'); commit; end; 注:pragma autonomouse_transcation 表示在这个过程中启动自治事务 建立正常情况下的插入过程 Create or Replace Procedure NonAutoNomouse_Insert as begin insert into Msg Values('NonAutonomouse Insert'); commit; end;下面在一个匿名块中分别调用上面的两个过程 begin insert into Msg Values('This Main Info'); NonAutoNomouse_Insert; rollback;endselect * from MsgMsg__________________________________________________This Main InfoNonAutonomouse Insert可以看到正个事务在过程NonAutoNomouse_Insert中被提交了Rollback并不起做用。下面调用自治事务的过程如下: begin insert into Msg Values('This Main Info'); AutoNomouse_Insert; rollback;endselect * from MsgMSG--------------------------------------------------------------------------AutoNomouse Insert可以看到在自治事务中只提交了自治事务内的更改,所以Rollback回滚了自治事务外的更改。相关文章推荐
- oracle自治事务
- Oracle 的自治事务 AUTONOMOUS TRANSACTION
- oracle 自治事务
- oracle存储过程自治事务
- Oracle嵌套事务(Nested Transaction)与自治事务(Autonomous Transaction)详解
- Oracle自治事务的介绍(Autonomous Transactions)
- [Oracle] 利用自治事务实现审计功能
- oracle自治事务(autonomous transaction)
- Oracle自治事务
- Oracle 自治事务 pragma autonomous_transaction
- PRAGMA AUTONOMOUS_TRANSACTION(oracle自治事务)
- oracle 的自治事务
- oracle 自治事务
- Oracle自治事务
- PRAGMA AUTONOMOUS_TRANSACTION oracle 自治事务
- Oracle自治事务的介绍(Autonomous Transactions)PRAGMA AUTONOMOUS_TRANSACTION;
- Oracle自治事务的介绍
- 【hello world!】Oracle 的自治事务
- Oracle Autonomous Transactions(自治事务)
- 关于Oracle AUTONOMOUS TRANSACTION(自治事务)的介绍