Transaction Control Language

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

  1. Commit
  2. Rollback
  3. Save point
Transaction

Any operation that can perform by using DML commands is known as Transaction.

Session

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Β 

  1. Normal Termination
  2. 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.

1. Commit

This command is used for save the transactions explicitly from the moment by user logon to the database to till execute this command.

Syntax

commit; Then commit will complete.
2. Rollback

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.

Syntax

rollback; Rollback complete
3. Save point

Save point is reference name for a particular set of transactions.

Syntax

savepoint <savepoint name>

E.g

savepoint s3;
rollback to savepoint  s1;

Note

We can’t rollback the committed transactions but we can commit the rollback transactions.

Transaction Control Language


Scroll to top