Wednesday, December 11, 2013

ORA-01086

You can only rollback to a savepoint if it was created in the current transaction. You can see this in the example below, which I tested on Oracle 11.2:
 
SQL> savepoint sp1;
 
Savepoint created.
 
SQL> commit;
 
Commit complete.
 
SQL> rollback to savepoint sp1;
rollback to savepoint sp1
*
ERROR at line 1:
ORA-01086: savepoint 'SP1' never established in this
session or is invalid
 
SQL> rollback to savepoint blah;
rollback to savepoint blah
*
ERROR at line 1:
ORA-01086: savepoint 'BLAH' never established in this
session or is invalid
 
SQL> savepoint sp2;
 
Savepoint created.
 
SQL> rollback to savepoint sp2;
 
Rollback complete.
 
SQL>

No comments: