Savepoints

You can set a savepoint at any point within a transaction and then roll back changes to that savepoint.


SQL> CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL,
  2                    ENAME VARCHAR2(10),
  3                    JOB VARCHAR2(9),
  4                    SAL NUMBER(7, 2),
  5                    DEPTNO NUMBER(2));

Table created.

SQL>
SQL> INSERT INTO EMP VALUES (1, 'SMITH', 'CLERK',     800,    20);

1 row created.

SQL>
SQL> SAVEPOINT save1;

Savepoint created.

SQL>
SQL> INSERT INTO EMP VALUES (2, 'SMITH', 'CLERK',     800,    20);

1 row created.

SQL>
SQL> ROLLBACK TO SAVEPOINT save1;

Rollback complete.

SQL>
Home »
Oracle »
Table » 

Database Transactions:
  1. Committing and Rolling Back a Transaction
  2. Starting and Ending a Transaction
  3. Savepoints
  4. ACID Transaction Properties
Related: