Incorporate COMMIT, ROLLBACK, and SAVEPOINT commands within PL/SQL.
COMMIT, ROLLBACK, and SAVEPOINT Commands
The three transaction control commands available to you within PL/SQL are:
What it does
This command saves all database changes permanently to the database. A COMMIT ends the transaction.
This command removes all database changes that were pending in the transaction, returning the database to it state prior to
the beginning of the transaction. A ROLLBACKROLLBACK ends the transaction.
This command marks a point somewhere within a transaction. You can roll back to a SAVEPOINT and only the
database changes processed after that SAVEPOINT are removed. A SAVEPOINT does not end the
Look at the following series of images to see how to use these three commands.
COMMIT, ROLLBACK, SAVEPOINT Code Examples
The primary use of the SAVEPOINT is for a single transaction that updates more than one table. Using the SAVEPOINT allows you to
ROLLBACK parts of the transaction while preserving other parts that succeeded.
The next lesson discusses another issue concerning transaction control: locking.