No. You can only define autonomous transactions at the top-level declaration of anonymous blocks:
create table t (
c1 int
);
declare
pragma autonomous_transaction;
begin
insert into t values ( 1 );
commit;
end;
/
begin
declare
pragma autonomous_transaction;
begin
insert into t values ( 2 );
commit;
end;
end;
/
PLS-00710: Pragma AUTONOMOUS_TRANSACTION cannot be specified here
begin
raise zero_divide;
exception
when zero_divide then
declare
pragma autonomous_transaction;
begin
insert into t values ( 3 );
commit;
end;
end;
/
PLS-00710: Pragma AUTONOMOUS_TRANSACTION cannot be specified here
select * from t;
C1
1
If you need a separate transaction in your exception handler (e.g. for error-logging), define the autonomous transaction in a procedure. And call that.