Sunday, 28 June 2015

Autonomous Transaction In PLSQL

Autonomous Transaction :
An autonomous transaction is an independent transaction started by another transaction, the main transaction. Autonomous transactions do SQL operations and commit or roll back, without committing or rolling back the main transaction.
For example, if you write auditing data to a log table, you want to commit the audit data even if the operation you are auditing later fails; if something goes wrong recording the audit data, you do not want the main operation to be rolled back.

Main Transaction called as Parent Transaction and subprogram transaction called as child Transaction.
  •  In Autonomous Transaction Child transaction Runs independentely of its parent transaction.
  •  The child transaction can Rollback or commit and then Parent transaction will resume.
  •  The parent transaction can continue without affecting child transaction.
Syntax:
You need to declare transaction as Pragma autonomous transaction in Declare section of PLSQL block.

PRAGMA AUTONOMOUS_TRANSACTION;

No comments:

Post a Comment

AP Invoice Notes related Table details in Oracle Fusion

 What is the table that stores the AP Invoice notes? AP notes are stored in ZMM_NOTES table with SOURCE_OBJECT_CODE = 'AP_STANDARD_INVOI...