✍ Kashif M
Trends

Monday, 2 September 2013


PRAGMA AUTONOMOUS_TRANSACTION in ORACLE


By on September 02, 2013


We can't give TCL statement (commit,rollback) in oracle trigger..

So what is the solution???


Write a procedure with commit and PRAGMA AUTONOMOUS_TRANSACTION and call this procedure inside the trigger as mention below.

Write procedure as follow..

create or replace
Procedure Test
As
PRAGMA AUTONOMOUS_TRANSACTION;
Begin
Insert Into Emp_Test Values (600,'Rama2',1000,'chennai');
commit;
END;


And fire a trigger as follows

create or replace
TRIGGER TRG_TEST
After Insert On Emp
FOR EACH ROW

Declare
  Begin
test();

End;


So in this way, you can write a TCL (commit,rollback) inside a trigger






Kashif
mkashu: PRAGMA AUTONOMOUS_TRANSACTION in ORACLE
Review : Kashif | Kashif
Update: September 02, 2013 | Rating: 4.5

Comment for "PRAGMA AUTONOMOUS_TRANSACTION in ORACLE"

0 comments

Post a Comment

Blog Archive