ITPub博客

首页 > 数据库 > 数据库开发技术 > Autonomous PL/SQL Blocks (151)

Autonomous PL/SQL Blocks (151)

原创 数据库开发技术 作者:tsinglee 时间:2007-11-06 14:57:52 0 删除 编辑

You can call autonomous transactions from within a PL/SQL block. Use the pragma
AUTONOMOUS_TRANSACTION. A pragma is a compiler directive. You can declare the
following kinds of PL/SQL blocks to be autonomous:
■ Stored procedure or function
■ Local procedure or function
■ Package
■ Type method
■ Top-level anonymous block
When an autonomous PL/SQL block is entered, the transaction context of the caller is
suspended. This operation ensures that SQL operations performed in this block (or
other blocks called from it) have no dependence or effect on the state of the caller’s
transaction context.
When an autonomous block invokes another autonomous block or itself, the called
block does not share any transaction context with the calling block. However, when an
autonomous block invokes a non-autonomous block (that is, one that is not declared to
be autonomous), the called block inherits the transaction context of the calling
autonomous block.

自治事务pl/sql块
1. 在pl/sql块中可以使用pragma(编译器指令) AUTONOMOUS_TRANSACTION 来调用自治事务
2. 以下类型的pl/sql块可为自治事务 : 存储过程或者函数(包括本地) , 包 , 类型方法 , 顶级匿名块
3. 当一个自治的块程序结构开始运行时,调用者的事务上下文环境就被挂起.这保证了自治事务块
(或由此自治事务块调用的其他结构)内的 SQL 操作与调用者的事务上下文环境相独立
4. 当一个自治事务块调用其他自治事务块或其自身时,被调用的不会与调用者共享任何事务上下文环境.
但当一个自治事务块调用一个非自治事务块时,被调用的程序结构将继承调用者的事务上下文环境.

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10599713/viewspace-980975/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    740
  • 访问量
    1897782