In this post I just want to post a sample code (which I use) to write debug in PL/SQL using PRAGMA AUTONOMOUS_TRANSACTION.
The AUTONOMOUS_TRANSACTION pragma changes the way a subprogram works within a transaction. A subprogram marked with this pragma can do SQL operations and commit or roll back those operations, without committing or rolling back the data in the main transaction. Read more
Feel free to point out if anything is missing/wrong in this blog.
The AUTONOMOUS_TRANSACTION pragma changes the way a subprogram works within a transaction. A subprogram marked with this pragma can do SQL operations and commit or roll back those operations, without committing or rolling back the data in the main transaction. Read more
--create tablecreate tablexxaj_debug (idnumber, msgvarchar2(4000), date_stampdate);--create sequencecreate sequencexxaj_seqstart with1increment by1;--create procedurecreate or replace procedurexxaj_proc ( msgvarchar2)is PRAGMAAUTONOMOUS_TRANSACTION;begininsert intoxxaj_debugvalues(xxaj_seq.nextval, msg,sysdate);commit;end;
Feel free to point out if anything is missing/wrong in this blog.
No comments:
Post a Comment