TCL Command
BY - SACHITAM PATEL
Introduction to TCL Commands
TCL stands for Transaction Control
Language, a subset of SQL commands.
It is used to manage changes made by DML
(Data Manipulation Language) operations.
TCL commands ensure data integrity and
consistency in database transactions.
Key TCL Commands
The primary TCL commands are :-
COMMIT
ROLLBACK
SAVEPOINT
• COMMIT saves all changes made during the current transaction to
the database.
• ROLLBACK undoes changes made in the current transaction,
reverting to the last COMMIT.
Using COMMIT
The COMMIT command is essential for
finalizing transactions in a database.
It ensures that all changes are permanently
recorded and available for future queries.
Without a COMMIT, changes made during a
transaction will not be saved if the connection is
closed.
Using ROLLBACK
The ROLLBACK command is used to revert
uncommitted changes in a transaction.
It is particularly useful for error handling when
a part of a transaction fails.
By rolling back, users can maintain data
integrity by preventing partial updates.
Using SAVEPOINT
SAVEPOINT allows users to set a marker
within a transaction for potential rollback.
This command enables partial rollback to a
specific point without affecting the entire
transaction.
It provides greater flexibility and control over
complex transactions in SQL.
THANK
YOU