Vikas
Vikas

Reputation: 107

PRAGMA AUTONOMOUS_TRANSACTION

I have procedure A with PRAGMA AUTONOMOUS_TRANSACTION to log the activity of a main program.

Now I am calling this program A in a procedure B to log the activity process in program B. If any error occurs in program A it fails the program B also. How I can avoid failing main program B.

Upvotes: 1

Views: 1091

Answers (1)

Littlefoot
Littlefoot

Reputation: 142958

What does that logging procedure do so that it might fail? Is it not a pure INSERT + COMMIT?

Anyway: the simplest (and probably the worst) option is to use exception handler section, e.g.

your_procedure is
begin
  do something;
exception
  when others then null;
end;

It would be OK if you really don't care whether something bad happened or not, but - what's the purpose, then? You think you did something, Oracle doesn't complain, the procedure does nothing and you have no idea what's going on.

Therefore, you'd better make sure that this "logging" procedure doesn't fail.

Upvotes: 3

Related Questions