Trigger execution failed:-6519: ORA-06519: autonomous transaction processing detected for activity, rolled back

Source: Internet
Author: User

Create or replace trigger tig_tt
After update on TT
For each row

Declare
Rstr varchar2 (1024 );
Pragma autonomous_transaction;
Begin
Insert into TT
(ID, text)
Values
(100, 'def _ failed: '| to_char (sysdate, 'yyyy-mm-dd hh24: MI: ss '));

Exception
When others then
Rstr: = 'trigger execution failed: '| sqlcode |': '| sqlerrm;
Dbms_output.put_line (rstr );
Insert into TT (ID, text) values (200, rstr );

End tig_tt;

 

SQL> update TT Set ID = 3;

Trigger execution failed:-6519: ORA-06519: autonomous transaction processing detected for activity, rolled back

Update TT Set ID = 3

ORA-04091: The table landuser. tt has changed and trigger/function cannot read it
ORA-06512: In "landuser. tig_tt", line 14
ORA-06519: detected active autonomous transaction processing, rolled back
ORA-04088: An error occurred while executing the trigger 'landuser. tig_tt'

Problem: No commit is submitted for autonomous transaction processing.

Modify as follows:

Create or replace trigger tig_tt
After update on TT
For each row

Declare
Rstr varchar2 (1024 );
Pragma autonomous_transaction;
Begin
Insert into TT
(ID, text)
Values
(100, 'def _ failed: '| to_char (sysdate, 'yyyy-mm-dd hh24: MI: ss '));
Commit;

Exception
When others then
Rstr: = 'trigger execution failed: '| sqlcode |': '| sqlerrm;
Dbms_output.put_line (rstr );
Insert into TT (ID, text) values (200, rstr );
Commit;

End tig_tt;

No errors

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.