ROLLBACK

From Oracle FAQ
(Redirected from Rollback)
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;

[edit] Partial rollback

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;

[edit] Also see