Oracle® Database PL/SQL User's Guide and Reference 10g Release 2 (10.2) Part Number B14261-01 |
|
|
PDF · Mobi · ePub |
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".
The SQL ROLLBACK
statement can be embedded as static SQL in PL/SQL. For syntax details on the SQL ROLLBACK
statement, see Oracle Database SQL Reference.
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.
For examples, see the following: