oracle 选择后提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14430424/
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
commit after select
提问by Alex
I have read the explanations when a commit
may be neccessary after a select
statement for DB2 and MySQL:
commit
在select
DB2 和 MySQL的语句之后可能需要 a时,我已经阅读了解释:
Is a commit needed on a select query in DB2?
Should I commit after a single select
My question is when and why would it be important to commit
after executing a select
statement using Oracle?
我的问题是何时以及为什么commit
在select
使用 Oracle执行语句之后很重要?
回答by DCookie
If you did a SELECT ... FOR UPDATE;
you would need a COMMIT or ROLLBACK to release the records held for update. Otherwise, I can't think of any reason to do this.
如果你做了一个,SELECT ... FOR UPDATE;
你需要一个 COMMIT 或 ROLLBACK 来释放为更新而保存的记录。否则,我想不出任何理由这样做。
回答by DazzaL
there are only a few situations that I can think of that you may want to commit after a select.
我能想到的只有几种情况,您可能希望在选择后提交。
if your select is joining on database links, a transaction will be created. if you attempt to close this link, you'd get an error unless you committed/rolled back the transaction.
select for update (as DCookie says) to release the locks.
to remove an serialized isolation level if set or to add one, if you've been selecting from db links prior to invoking this.
如果您的选择加入数据库链接,则会创建一个事务。如果您尝试关闭此链接,除非您提交/回滚事务,否则您会收到错误消息。
选择更新(如 DCookie 所说)以释放锁。
删除序列化隔离级别(如果已设置)或添加一个(如果您在调用此之前一直从数据库链接中进行选择)。