Rolls back to a savepoint.
ROLLBACK [ WORK ] TO [ SAVEPOINT ] savepoint_name
You can use the
ROLLBACK TO SAVEPOINT command to roll back all commands that are run after the specified savepoint is created.
The savepoint remains valid and can be rolled back to again later if needed.
ROLLBACK TO SAVEPOINT implicitly deletes all savepoints that are created after the specified savepoint.
|savepoint_name||The savepoint to which to roll back.|
An error occurs if you specify a savepoint name that does not exist.
SPL programs do not support
ROLLBACK TO SAVEPOINT.
Undo the effects of commands that are run after the depts savepoint:
\set AUTOCOMMIT off INSERT INTO dept VALUES (50, 'HR', 'NEW YORK'); SAVEPOINT depts; INSERT INTO emp (empno, ename, deptno) VALUES (9001, 'JONES', 50); INSERT INTO emp (empno, ename, deptno) VALUES (9002, 'ALICE', 50); ROLLBACK TO SAVEPOINT depts;