ROLLBACK

From Oracle FAQ
Jump to: navigation, search

ROLLBACK is an SQL command used to undo changes made to the database (restore data to its state prior to the user making changes).

Example:

INSERT INTO tab1 VALUES ('val1', 'val2', 'val3');
ROLLBACK;

Partial rollback[edit]

One can specify savepoints to mark a point in a transaction to rollback to. Example:

DELETE FROM emp WHERE empno = 123;
SAVEPOINT x;
UPDATE emp SET sal = sal * 1.1;
ROLLBACK TO SAVEPOINT x;
COMMIT;

Also see[edit]