Transaction Control Language (TCL)
TCL commands are used to manage transactions in database. These are used to manage the changes made by DML statements. It also allows statements to be grouped together into logical transactions. This is the third sub language in SQL which contains the commands
- Save point
Any operation that can perform by using DML commands is known as Transaction.
It can be defined as some interval of time or some span of time. It means that the moment the user log on to the database to the user logoff to the database this span of the time is known as session. We can terminate the session two ways
- Normal Termination
- Abnormal Termination
1. Normal Termination
Terminating the session by typing exit or quit SQL prompt then this termination can be called as Normal Termination. Normal Termination always saves our Transactions.
2. Abnormal Termination
Terminating the session by directly close the window button or directly switch off the C.P.U or power off. Abnormal Termination does not save our transaction.
This command is used for save the transactions explicitly from the moment by user logon to the database to till execute this command.
commit; Then commit will complete.
This command is used to discard the transactions from the moment the user logon to the database till execute this command or executing the commit command too.
rollback; Rollback complete
3. Save point
Save point is reference name for a particular set of transactions.
savepoint <savepoint name>
savepoint s3; rollback to savepoint s1;
We can’t rollback the committed transactions but we can commit the rollback transactions.