I have a subprogram in PL/SQL that has
PRAGMA AUTONOMOUS_TRANSACTION
directive.
It seems like only in this subprogram(there’s a set of procedures that are used in the same way, but they don’t have this pragma) changes in the transaction that called this procedure are not visible!
I don’t get it.
Other procedures see changes made within transactions, except for those who have this pragma directive. Is it a toll for being able to do separate commits?
Yes, an autonomous transaction is exactly that – autonomous and separate from the transaction from which it is called; neither can see the other’s changes until they are committed. There are very few good reasons to use autonomous transactions: the main valid use that comes to mind is error logging. Often they are misused, particularly in triggers to avoid the “table is mutating” exception. What is the purpose of the autonomous transaction in your procedure?