Pragma autonomous_transaction
The current stored procedure runs as a subtransaction of an existing transaction. The commit and rollback operations of the subtransaction do not affect the status of the parent transaction.
Can be used
(1) Anonymous Block
(2) triggers
(3) Stored Procedure
As follows :--------------------------------------------------------------------
Procedure addrowautonomous
(
PID in tlog. ID % type,
Pldate in tlog. ldate % type,
Plhsecs in tlog. lhsecs % type,
Pllevel in tlog. Llevel % type,
Plsection in tlog. lsection % type,
Pluser in tlog. luser % type,
Pltexte in tlog. ltexte % Type
)
Is
Pragma autonomous_transaction;
Begin
Addrow
(
PID => PID,
Pldate => pldate,
Plhsecs => plhsecs,
Pllevel => pllevel,
Plsection => plsection,
Pluser => pluser,
Pltexte => pltexte
);
Commit;
Exception when others then
Plog. error;
Rollback;
Raise;
End;
In the program, pay attention to the transaction control, do not have omissions, otherwise there will be a ORA-06519