Search notes:

ORA-06519: active autonomous transaction detected and rolled back

create or replace function exec_immediate(stmt clob) return clob as
    pragma autonomous_transaction;
begin

    execute immediate stmt;
    return stmt;

end exec_immediate;
/
create table tq84_test(a number);
The following statement throws ORA-06519: active autonomous transaction detected and rolled back:
select
   exec_immediate('insert into tq84_test values(42)')
from
   dual;
In order to prevent this error, an explicit commit (or rollback) is required in the function:
create or replace function exec_immediate(stmt clob) return clob as
    pragma autonomous_transaction;
begin

    execute immediate stmt;

    COMMIT;
    return stmt;

end exec_immediate;
/

See also

ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML
ORA-14551: cannot perform a DML operation inside a query
Other Oracle error messages

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758206775, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/errors/ORA-06519_active-autonomous-transaction-detected-and-rolled-back/index(73): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78