dba2015
dba2015

Reputation: 127

What does COMMIT do?

What is the difference between the following statements:

insert into table_name values (,,,,,);

And:

insert into table_name values (,,,,,);
commit;

Upvotes: 9

Views: 22946

Answers (2)

Moudiz
Moudiz

Reputation: 7377

All the DML (insert, update , delete) to be inserted in the database you have to commit them, like approve that you want to add them in the database. If you dont commit DML statment , it will not be enter in the database.

what is commit ?

Docs.oracle cant describe it better

Use the COMMIT statement to end your current transaction and make permanent all changes performed in the transaction. A transaction is a sequence of SQL statements that Oracle Database treats as a single unit. his statement also erases all savepoints in the transaction and releases transaction locks.

Upvotes: 3

Ishikawa Yoshi
Ishikawa Yoshi

Reputation: 1789

If you insert data without commit you can select data from database and see it. But other users can't.

It's better to look to sql documentation:

Until you commit a transaction:

You can see any changes you have made during the transaction by querying the modified tables, but other users cannot see the changes. After you commit the transaction, the changes are visible to other users' statements that execute after the commit.

You can roll back (undo) any changes made during the transaction with the ROLLBACK statement (see ROLLBACK.

for example here Oracle Documentation and some info about transactions

Upvotes: 16

Related Questions