Thursday, 8 September 2011

Commits and nested autonomous transactions

Question:
What would be the effect of a procedure defined as an "autonomous transaction" calling a function that is not defined as "autonomous" and contains commits?
Answer:
Joyce,
If program AUTON is defined as an autonomous transaction, the DML of any programs it calls become a part of AUTON's transaction—unless that subprogram is also, in turn, defined as an autonomous transaction. Therefore, a commit in a nested program will commit AUTON's overall transaction.
If AUTON calls another program that in turn is an autonomous transaction (let's call it AUTON2), then a commit in AUTON2 will not affect any outstanding changes in AUTON.
Click here to view a script I put together to confirm what I've told you here. Give it a try!

No comments:

Post a Comment