0% found this document useful (0 votes)
21 views8 pages

5.SQL Queries Tcl

The document explains Transaction Control Language (TCL) commands used to manage database transactions, including the Commit, Rollback, and Savepoint commands. It provides the syntax for each command and illustrates their usage with an example involving a class table. The example demonstrates how to insert, commit, and rollback transactions to specific savepoints in the database.

Uploaded by

dharani thaneeru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views8 pages

5.SQL Queries Tcl

The document explains Transaction Control Language (TCL) commands used to manage database transactions, including the Commit, Rollback, and Savepoint commands. It provides the syntax for each command and illustrates their usage with an example involving a class table. The example demonstrates how to insert, commit, and rollback transactions to specific savepoints in the database.

Uploaded by

dharani thaneeru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

SQL QUERIES-3

TCL-COMMANDS
• Transaction Control Language(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.
1.Commit command

• Commit command
• Commit command is used to permanently save any
transaaction into database.
• Following is Commit command's syntax,
• commit;
2.Rollback command

• Rollback command
• This command restores the database to last
commited state. It is also use with savepoint
command to jump to a savepoint in a transaction.
• Following is Rollback command's syntax,
• rollback to savepoint-name;
3. Savepoint command

• savepoint command is used to temporarily save a


transaction so that you can rollback to that point
whenever necessary.
• Following is savepoint command's syntax,
• savepoint savepoint-name;
• Savepoint A;
Example of Savepoint and Rollback

• Following is the class table,


ID NAME
1 abhi
2 adam
4 alex

• Lets use some SQL queries on the above table and


see the results.
1. INSERT into class values(5,'Rahul');
2. commit;
3. UPDATE class set name='abhijit' where id='5';
savepoint A;
4. INSERT into class values(6,'Chris');
5. savepoint B;
6. INSERT into class values(7,'Bravo');
7. savepoint C; SELECT * from class;
• The resultant table will look like,
Now ID NAME
• rollback to B; 1 abhi
2 adam
• SELECT * from class;
4 alex
• rollback to A; 5 abhijit
6 chris
• SELECT * from class;
7 bravo
• You will see how data is displayed

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy