Autonomous Transactions : Autonomous Transaction « PL SQL Statements « Oracle PL/SQL Tutorial

Home
Oracle PL/SQL Tutorial
1.Introduction
2.Query Select
3.Set
4.Insert Update Delete
5.Sequences
6.Table
7.Table Joins
8.View
9.Index
10.SQL Data Types
11.Character String Functions
12.Aggregate Functions
13.Date Timestamp Functions
14.Numerical Math Functions
15.Conversion Functions
16.Analytical Functions
17.Miscellaneous Functions
18.Regular Expressions Functions
19.Statistical Functions
20.Linear Regression Functions
21.PL SQL Data Types
22.PL SQL Statements
23.PL SQL Operators
24.PL SQL Programming
25.Cursor
26.Collections
27.Function Procedure Packages
28.Trigger
29.SQL PLUS Session Environment
30.System Tables Data Dictionary
31.System Packages
32.Object Oriented
33.XML
34.Large Objects
35.Transaction
36.User Privilege
Oracle PL/SQL Tutorial » PL SQL Statements » Autonomous Transaction 
22.21.1.Autonomous Transactions

Oracle can suspend a transaction and transfer execution control to an independent child transaction.

This child transaction is called an autonomous transaction.

An autonomous transaction is completely independent of the calling transaction.

An autonomous transaction does not share resources, locks, or any commit dependencies with the main transaction.

Autonomous transactions can include just as much functionality as any other database transactions.

Autonomous transactions are useful for creating software components that can be reused in numerous applications.

One advantage of using an autonomous transaction is that DML can be executed and committed, even if the main transaction is rolled back.

Setting up the syntax for an autonomous transaction

Autonomous Transaction Syntax

declare
    pragma autonomous_transaction;
begin
    ...
    number of statements
    ...
 commit;(or rollback;?End of transaction 1
    ...
    number of statements
    ...
 commit;(or rollback;?End of transaction 2
end;

A pragma autonomous transaction is a PL/SQL compiler directive to define an autonomous transaction.

This PL/SQL compiler directive can be used to define:

Top-level anonymous blocks

Local, standalone, or packaged functions and procedures

Database triggers

Methods of object types

Quote from:

Oracle PL/SQL For Dummies (Paperback)

by Michael Rosenblum (Author), Paul Dorsey (Author)

# Paperback: 414 pages

# Publisher: For Dummies (June 13, 2006)

# Language: English

# ISBN-10: 0764599577

# ISBN-13: 978-0764599576

22.21.Autonomous Transaction
22.21.1.Autonomous Transactions
22.21.2.Audit as Autonomous Transaction
22.21.3.Non-Working p_log_audit
22.21.4.Mark an anonymous block 'pragma autonomous_transaction'
22.21.5.'pragma autonomous_transaction' package member procedure
22.21.6.Commit an Insert statement in a 'pragma autonomous_transaction' procedure
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.