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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:23:35  来源:igfitidea点击:

commit after select

sqloracleselectcommit

提问by Alex

I have read the explanations when a commitmay be neccessary after a selectstatement for DB2 and MySQL:

commitselectDB2 和 MySQL的语句之后可能需要 a时,我已经阅读了解释:

Is a commit needed on a select query in DB2?

DB2 中的选择查询是否需要提交?

Should I commit after a single select

我应该在一次选择后提交吗

My question is when and why would it be important to commitafter executing a selectstatement using Oracle?

我的问题是何时以及为什么commitselect使用 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.

我能想到的只有几种情况,您可能希望在选择后提交。

  1. 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.

  2. select for update (as DCookie says) to release the locks.

  3. to remove an serialized isolation level if set or to add one, if you've been selecting from db links prior to invoking this.

  1. 如果您的选择加入数据库链接,则会创建一个事务。如果您尝试关闭此链接,除非您提交/回滚事务,否则您会收到错误消息。

  2. 选择更新(如 DCookie 所说)以释放锁。

  3. 删除序列化隔离级别(如果已设置)或添加一个(如果您在调用此之前一直从数据库链接中进行选择)。