15

I have read the explanations when a commit may be neccessary after a select statement for DB2 and MySQL:

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?

1
  • I am no Oracle pro, so perhaps someone more knowledgeable can comment on this, but I have run scripts that have executed a large number of large select statements, which eventually returned database server temp space issues. Committing after each select eliminated this. Commented Jan 21, 2013 at 1:50

2 Answers 2

17

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.

Sign up to request clarification or add additional context in comments.

Comments

15

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.