TCL (Transaction Control Language)
TCL (Transaction Control Language) commands are used to manage transactions, which are a series of database operations treated as a single unit. These commands ensure data integrity by controlling how changes are committed or rolled back.
COMMIT
Makes all changes performed within a transaction permanent. This saves the changes to the database.
Syntax
Example
ROLLBACK
Undoes all changes made within a transaction, reverting the database to its state before the transaction began.
Syntax
Example
In Oracle and most relational database systems, transactions do function as atomic units. This means all changes within a transaction are treated as a single entity. If any statement within the transaction fails due to an exception, the entire transaction automatically rolls back, undoing all the changes attempted within that transaction block.
SAVEPOINT
Creates a named point within a transaction. We can optionally roll back to a specific savepoint instead of the entire transaction.
Syntax
Example
SET TRANSACTION
Defines isolation level and other transaction characteristics. Used for advanced control over transaction behavior.
Syntax
Example
Last updated