Skip Headers
Oracle® Database PL/SQL User's Guide and Reference
10g Release 2 (10.2)

Part Number B14261-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

ROLLBACK Statement

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.

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.

Examples

For examples, see the following:


Example 2-14, "Using a Block Label for Name Resolution"
Example 6-37, "Using ROLLBACK"
Example 6-38, "Using SAVEPOINT With ROLLBACK"
Example 6-39, "Reusing a SAVEPOINT With ROLLBACK"

Related Topics


"COMMIT Statement"
"SAVEPOINT Statement"