Blog Archives

Debugging a Package using pragma autonomous Procedure

We may put insert statement in Procedure to Debug. But in workflow or in any other commit sensitivewe can’t use the direct Insert and so we can use the below Procedure.

As Pragma will be independent of the session and hence debugging in Workflow procedure will be Easy.

CREATE OR REPLACE PROCEDURE APPS.XX_DEBUG(P_MSG IN VARCHAR2)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO XX_DEBUG_MESSAGE
VALUES (SYSDATE, P_MSG);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;

CREATE TABLE XX_DEBUG_MESSAGE (
DT DATE,
MSG VARCHAR2(2000)
);