PL/SQL User's Guide and Reference 10g Release 1 (10.1) Part Number B10807-01 |
|
|
View PDF |
The ROLLBACK
statement is the inverse of the COMMIT
statement. It undoes some or all database changes made during the current transaction. For more information, see "Overview of Transaction Processing in PL/SQL".
Syntax
Keyword and Parameter Description
When a parameterless ROLLBACK
statement is executed, all database changes made during the current transaction are undone.
Undoes all database changes (and releases all locks acquired) since the savepoint identified by savepoint_name
was marked.
Optional, for readability only.
An undeclared identifier, which marks the current point in the processing of a transaction. For naming conventions, see "Identifiers".
Optional, for readability only.
Usage Notes
All savepoints marked after the savepoint to which you roll back are erased. The savepoint to which you roll back is not erased. For example, if you mark savepoints A, B, C, and D in that order, then roll back to savepoint B, only savepoints C and D are erased.
An implicit savepoint is marked before executing an INSERT
, UPDATE
, or DELETE
statement. If the statement fails, a rollback to this implicit savepoint is done. Normally, just the failed SQL statement is rolled back, not the whole transaction. If the statement raises an unhandled exception, the host environment determines what is rolled back.
In SQL, the FORCE
clause manually rolls back an in-doubt distributed transaction. PL/SQL does not support this clause. For example, the following statement is not allowed:
ROLLBACK WORK FORCE '24.37.85'; -- not allowed
In embedded SQL, the RELEASE
option frees all Oracle resources (locks and cursors) held by a program and disconnects from the database. PL/SQL does not support this option. For example, the following statement is not allowed:
ROLLBACK WORK RELEASE; -- not allowed
Related Topics