Re: Certain dynamic sql statements make stored procedures "forget" transaction?

From: Gunter Herrmann <notformail0106_at_earthlink.net>
Date: Wed, 15 May 2013 17:29:22 -0400
Message-ID: <5193fe33$0$6563$9b4e6d93_at_newsspool4.arcor-online.net>



Hi!

neilsolent wrote:
> Ah OK - I didn't notice you said there is a commit before as well as
> after the DDL statements.
> That does make it harder to cater for all possible errors.
> As you say - better to do the audit record insert after the DDL in
> that case.

Inserts to log files should always be made as an autonomous transaction. So that log will never be rolled back.

CREATE OR REPLACE procedure UTILITY.do_protocol (p_text varchar2) as pragma autonomous_transaction;
begin

    insert into protocol (text, ins_timestamp)

       values (p_text, systimestamp);
    commit;
end;
/

HTH Gunter Received on Wed May 15 2013 - 23:29:22 CEST

Original text of this message