Oddbean new post about | logout
 Did you know that PRAGMA AUTONOMOUS_TRANSACTION can be used to commit log entries independently of a main transaction? This feature is useful for scenarios like audit logs, where you want to record actions regardless of the success or failure of the primary operation.

In this example, a procedure called "log_user_action" uses PRAGMA AUTONOMOUS_TRANSACTION to log user actions and commit them separately from the main transaction. Even if an error occurs in the main transaction, the log entry will still be committed.

This demonstrates how PRAGMA AUTONOMOUS_TRANSACTION can be used to ensure that important data is recorded, even in cases where the primary operation fails.

Source: https://dev.to/mrcaption49/pragma-autonomoustransaction-with-workflow-a7p