PRAGMA AUTONOMOUS_TRANSACTION.sql

CREATE PROCEDURE PRAGMA_LOG (I_LOG_MESSAGE IN VARCHAR2) IS BEGIN PRAGMA AUTONOMOUS_TRANSACTION; INSERT INTO LOG_TABLE (I_LOG_MESSAGE); COMMIT; END; / CREATE PROCEDURE BUSINESS_AS_USUAL IS BEGIN INSERT INTO LOG_TABLE ('BEFORE ACTION 1'); --PERFORMING ACTION 1 -- ... INSERT INTO LOG_TABLE ('LOGGING ACTION 1'); INSERT INTO LOG_TABLE ('BEFORE ACTION 2'); --PERFORMING ACTION 2 -- ... INSERT INTO LOG_TABLE ('LOGGING ACTION 2'); --COMMITING ALL ACTIONS PERFORMED COMMIT; EXCEPTION WHEN OTHERS THEN INSERT INTO LOG_TABLE (SQLERRM); ROLLBACK; END; /
PL / SQL - PRAGMA AUTONOMOUS_TRANSACTION

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.