Does anybody know, why i get an ORA-01086: savepoint 'SPX' never established in this session or is invalid in the following Code?
begin
rollback; --clear all Transactions
execute immediate 'begin
savepoint SPX;
raise no_data_found;
end;';
exception when no_data_found then
rollback to savepoint SPX;
end;
It is working if i don't use execute immediate:
begin
rollback; --clear all Transactions
begin
savepoint SPX;
raise no_data_found;
end;
exception when no_data_found then
rollback to savepoint SPX;
end;
So is this an expected behaviour or is this something like a bug?
I'm using Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
Update: the following Example is also working, it uses dynamic SQL combined with Savepoints:
begin
rollback; --clear all Transactions
execute immediate 'begin
savepoint SPX;
end;';
rollback to savepoint SPX;
end;