oracle COMMIT 有什么作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29385655/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does COMMIT do?
提问by dba2015
please I want to understand the difference between the folowing two statements:
请我想了解以下两个陈述之间的区别:
insert into table_name values (,,,,,);
and
和
insert into table_name values (,,,,,);
commit;
回答by Ishikawa Yoshi
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:
最好查看 sql 文档:
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.
直到您提交事务:
您可以通过查询修改后的表来查看您在事务期间所做的任何更改,但其他用户看不到这些更改。提交事务后,更改对提交后执行的其他用户的语句可见。
您可以使用 ROLLBACK 语句回滚(撤消)事务期间所做的任何更改(请参阅 ROLLBACK。
for example here Oracle Documentationand some info about transactions
回答by Moudiz
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.
要插入到数据库中的所有 DML(插入、更新、删除),您必须提交它们,例如批准您要将它们添加到数据库中。如果你不提交 DML 语句,它不会被输入到数据库中。
what is commit ?
什么是提交?
Docs.oraclecant describe it better
Docs.oracle无法更好地描述它
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.
使用 COMMIT 语句结束当前事务并使事务中执行的所有更改永久化。事务是 Oracle 数据库将其视为单个单元的 SQL 语句序列。他的语句还会删除事务中的所有保存点并释放事务锁。