0% found this document useful (0 votes)
20 views3 pages

Exp 9 TCL

The document outlines an experiment to utilize Transaction Control Language (TCL) commands, including SAVEPOINT, ROLLBACK, and COMMIT. It provides a step-by-step procedure for creating a table, inserting records, and applying TCL commands to manage transactions. The SQL commands and their descriptions are also included, demonstrating the execution of various TCL operations.

Uploaded by

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

Exp 9 TCL

The document outlines an experiment to utilize Transaction Control Language (TCL) commands, including SAVEPOINT, ROLLBACK, and COMMIT. It provides a step-by-step procedure for creating a table, inserting records, and applying TCL commands to manage transactions. The SQL commands and their descriptions are also included, demonstrating the execution of various TCL operations.

Uploaded by

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

Experiment: No.

9 To make use of transaction control


statements viz
rollback, commit and savepoint

AIM:
To execute and verify the TCL Language commands

TCL (TRANSACTION CONTROL LANGUAGE)


 SAVE POINT
 ROLL BACK
 COMMIT

PROCEDURE
STEP 1: Start
STEP 2: Create the table with its essential attributes.
STEP 3: Insert the record into table
STEP 4: use save point if any changes occur in any portion of the record to
undo its
original state.
STEP 5: use rollback for completely undo the records
STEP 6: use commit for permanently save the records.

SQL COMMANDS

1. COMMAND NAME: CREATE


COMMAND DESCRIPTION: CREATE command is used to create objects
in the database.

2. COMMAND NAME: INSERT


COMMAND DESCRIPTION: INSERT command is used to Insert objects
in the database.

3. COMMAND NAME: SELECT


COMMAND DESCRIPTION: SELECT command is used to SELECT the object
from
the database.

4. COMMAND NAME: SAVE POINT


COMMAND DESCRIPTION: SAVE POINT command is used to undo the
Records in a particular transaction.

5. COMMAND NAME: ROLLBACK


COMMAND DESCRIPTION: ROLL BACK command is used to undo the
Records.
6. COMMAND NAME: COMMIT
COMMAND DESCRIPTION: COMMIT command is used to save the
Records.

SQL>CREATE TABLE EMP (EMPNO NUMBER (4),


ENAME VARCHAR2 (10),
DESIGNATION VARCHAR2 (10),
SALARY NUMBER (8,2));
Table created.

INSERT
Q. Write a query to insert the records in to employee.

SQL>INSERT INTO EMP VALUES(101,'NAGARAJAN','LECTURER',15000);


INSERT INTO EMP VALUES(102,'SARAVANAN','LECTURER','15000');
2 row created.

SELECT
SQL> SELECT * FROM EMP;

EMPNO ENAME DESIGNATIN SALARY


---------- ------------ ---------- ----------
101 NAGARAJAN LECTURER 15000
102 SARAVANAN LECTURER 15000

TCL (TRANSACTION CONTROL LANGUAGE)

SAVEPOINT:

Q. Write a query to implement the save point.

Syntax for save point:


SQL> SAVEPOINT <SAVE POINT NAME>;

SQL> SAVEPOINT S1;

Savepoint created.

SQL> SELECT * FROM EMP;

EMPNO ENAME DESIGNATIN SALARY


---------- ------------ - --------- ----------
101 NAGARAJAN LECTURER 15000
102 SARAVANAN LECTURER 15000

SQL> INSERT INTO EMP VALUES(105,'PARTHASAR','STUDENT',100);


1 row created.

SQL> SELECT * FROM EMP;

EMPNO ENAME DESIGNATIN SALARY


----- ------------ ---------- ----------
105 PARTHASAR STUDENT 100
101 NAGARAJAN LECTURER 15000
102 SARAVANAN LECTURER 15000

ROLL BACK

Q. Write a query to implement the Rollback.


Syntax for Rollback:

SQL> ROLL BACK <SAVE POINT NAME>;

SQL> ROLL BACK S1;

Rollback complete.

SQL> SELECT * FROM EMP;

EMPNO ENAME DESIGNATIN SALARY


---------- ------------ ---------- ----------
101 NAGARAJAN LECTURER 15000
102 SARAVANAN LECTURER 15000

COMMIT

Q. Write a query to implement the Rollback.


Syntax for commit:
SQL> COMMIT;

SQL> COMMIT;
Commit complete.

Result: Various TCL commands has been executed

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