Skip to content

A Custom Event Action's PL/SQL block, wrapped in `Pragma autonomous_transaction`, never seems to enter its own FOR loop over the just-saved record — even a debug error message placed inside the loop never fires — even though the exact same query returns rows correctly when run directly in a PL/SQL tool. What's going on?

Answer

Pragma autonomous_transaction runs that PL/SQL block in a separate, independent transaction from the main save transaction the Custom Event fired from — since the record you're querying for hasn't been committed by the still-in-progress main transaction yet, the autonomous block's own query genuinely finds no matching rows to loop over, even though the same query works fine once run standalone against already-committed data. Removing the Pragma autonomous_transaction (so the block runs in the same transaction context as the save) resolves this, though it changes the transactional semantics of the block — worth confirming that's actually the intended behavior for your specific use case before relying on it.

← Browse Platform, Aurena, and customization questions