Type Here to Get Search Results !

Transaction Control Language: TCL Commands in SQL

TCL Commands in SQL
TCL Commands in SQL Notes in Hindi

TCL (Transaction Control Language)

→ Database या table में changement (insert, update, delete) = Transaction

(1) Commit

→ Database में transaction permanently change करने के लिए commit किया जाता है |

(2) Rollback

→ Transaction की चेंजिंग हटाने के लिए/ transaction को निष्क्रिय करने के लिए |

(3) Save Point

→ Transaction में mark set करने के लिए।

Commit:

Commit Example

Changes 1: insert into student values (107, 'Sunil', 29);
Changes 2: update student set age=35 where Roll.No=105;
Changes 3: delete from student where Roll.No=102;

commit; — यह db file में permanent save हो जाएगा

Rollback:

Rollback : Rollback के द्वारा last commit के बाद की सभी operation को discard कर दिया जाता है।

Rollback Example

commit; (last commit)
        	update student set age=40 where Roll.No=103; (X)
       		insert into student values (108, 'Ram', 30); (X)
        	delete from student; (X)— by mistake perform work
       		Rollback; → last commit के बाद का work remove कर देता है।

Savepoint:

Transaction के बीच mark set करने के लिए |

Savepoint का उपयोग selected transaction को rollback करने के लिए किया जा सकता है।

Savepoint Example

	insert into student values (109, 'Ram', 30);
	Savepoint A;
	update student set age = 35 where Roll_No = 101;
	Savepoint B;
	delete from student; → यह operation by mistake हो गया।
	Rollback B;

Savepoint B के बाद का operation cancel हो जाएगा।

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.