Thursday, October 18, 2012

Transaction Control Language (TCL) Overview



Transaction Control Language (TCL) :
=======================
             This is the fourth sub language in SQL, which contains three commands.

  • Commit 
  • Rollback 
  • Savepoint

Transaction :
==========
          Any operation which we can perform using DML commands on the database is called as transaction.
Session:
======
         It is the interval of time, the moment by user logon to the database to the user log off from the database is known as session.
      We can terminate the session in two ways.
        1)Normal Termination
        2)Abnormal Termination

Normal Termination:
===============
          Terminating the session by typing either exit/quit is known as normal termination. Normal termination always saves the transactions.
Abnormal Termination:
=================
         Terminating the session by directly switch off the system (or) power off (or) directly closing the window button.

COMMIT:
========
This command is used to save the transactions explicitly from the user logon to the database to till type this command
Syntax: commit;

ROLL BACK:
===========
This command is used to discard the transactions performed by the end user. This command discard the transactions the moment the user log on to the database to the moment the user execute this command (or) the moment by user executing the commit command to till type this command.

Syntax: rollback;

SAVEPOINT:
=========
Save point is a reference name for particular set of transactions.Using this we can identify a point in a transaction to which you can later roll back
Syntax: savepoint <savepoint_name>;
Example: savepoint s;


NOTE: we can commit the rollback transactions but we can’t rollback the committed transactions.


No comments:

Post a Comment

back to top