Wednesday, April 28, 2010

ROLLBACK in Oracle

The ROLLBACK statement is the inverse of the COMMIT statement. It undoes some or all database changes made during the current transaction.
Syntax:

ROLLBACK [WORK] [TO [SAVEPOINT] savepoint_name];

When a parameterless ROLLBACK statement is executed, all database changes made during the current transaction are undone.
ROLLBACK TO
This statement undoes all database changes (and releases all locks acquired) since the savepoint identified by savepoint_name was marked.
SAVEPOINT
This keyword is optional and has no effect except to improve readability.
savepoint_name
This is an undeclared identifier, which marks the current point in the processing of a transaction. For naming conventions, see "Identifiers".
WORK
This keyword is optional and has no effect except to improve readability.