Pages

Monday, March 16, 2015

PL/SQL example for Procedure with PRAGMA AUTONOMOUS_TRANSACTION

===========================================
General
===========================================
Example of  PRAGMA AUTONOMOUS_TRANSACTION Procedure.

===========================================
Procedure to write to a log table.
===========================================

PROCEDURE WRITE_LOG(p_module_name IN VARCHAR2, p_msg_text IN VARCHAR2) IS
   PRAGMA AUTONOMOUS_TRANSACTION;
-- Purpose : Insert new record to the trace table
BEGIN
INSERT INTO MY_TRACE(MODULE, msg_date, msg_text)
VALUES(p_module_name , SYSDATE, p_msg_text);
COMMIT;
END WRITE_LOG;

No comments:

Post a Comment