Can "pragma autonomous transaction" called from exception block?
685758Aug 29 2011 — edited Aug 29 2011CREATE OR REPLACE TRIGGER TRIG_EMP
AFTER UPDATE
ON EMP
FOR EACH ROW
DECLARE
CNT NUMBER := 0 ;
BEGIN
UPDATE EMP_bkp
SET COMM=999
WHERE ENAME ='SMITH';
COMMIT; -- it will generate error as commit cnt b use inside trigger so code wil go to exception blk.
exception
when others then
declare
PRAGMA AUTONOMOUS_TRANSACTION;
begin
commit;
end;
END;
why code is giving error?cant i put PRAGMA AUTONOMOUS_TRANSACTION in exception block although i have putted it into declare.. begin.. end block.
It might be unnecesary question but i m in delema why we cnt use pragma in exception block when any error ocur in code.as we can call any proc,func via exception block then why not we can call pragma?