You are on page 1of 1

COMMIT is a part of Transaction Control Language (TCL) that allows us to com mit the database transactions i.e.

to save the work permanently in the database. Commit plays a vital role when we work on DML operations because we need to explicitly save it.

Commit has two types 1. Explicit Commit User have to Commit explicitly when ever any DML operations l ike insert, update, delete are performed on the database table. Oracle SQL Commit Syntax: COMMIT; Example:-For example we are inserting record into emp table Shown below SQL> INSERT INTO emp VALUES (7125, SCOTT ,'ANALYST', 7902,'22-DEC-1982', 15000, 1000 , 20); Output: 1 ROW created -- To save the record into the database execute commit. SQL> Commit; Output: Commit complete For some reason we did not commit the record after DML operation then if system c rashes or if session is ended data will be lost from cache. i.e. even we inserted t he record we will not be able to see it in the database table. 2. Implicit Commit system will automatically execute commit when ever we perform any DDL Commands like create, alter, drop. That is the reason if we perform any DDL command we will not be able to revert b ack the operation (like using ROLLBACK command). Example: SQL>TRUNCATE TABLE emp; -- Data will be permanently deleted from EMP table. (AUTO COMMIT) For more details: check http://newtonapples.com/

You might also like