SQL>
SQL>
SQL> CREATE TABLE emp (
2 empID INT NOT NULL PRIMARY KEY,
3 Name VARCHAR(50) NOT NULL);
Table created.
SQL> INSERT INTO emp (empID,Name) VALUES (1,'Tom');
1 row created.
SQL> INSERT INTO emp (empID,Name) VALUES (2,'Jack');
1 row created.
SQL> INSERT INTO emp (empID,Name) VALUES (3,'Mary');
1 row created.
SQL> INSERT INTO emp (empID,Name) VALUES (4,'Bill');
1 row created.
SQL> INSERT INTO emp (empID,Name) VALUES (5,'Cat');
1 row created.
SQL> INSERT INTO emp (empID,Name) VALUES (6,'Victor');
1 row created.
SQL>
SQL> SAVEPOINT BeforeAddingBademp;
Savepoint created.
SQL> INSERT INTO emp (empID, Name) VALUES (99, 'Bad emp');
1 row created.
SQL> ROLLBACK TO BeforeAddingBademp;
Rollback complete.
SQL>
SQL> COMMIT;
Commit complete.
SQL>
SQL>
SQL>
SQL> drop table emp;
Table dropped.
35.4.SAVEPOINT |
| 35.4.1. | Savepoints |
| 35.4.2. | Transactions and Savepoints |