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?
If you are in read committed, single database instance, you don't really need to commit or rollback. If you are in serializable (or read only), single database instance, you need to commit when you would like to be able to see newly committed data from other sessions.
The COMMIT command saves all the transactions to the database since the last COMMIT or ROLLBACK command. The syntax for the COMMIT command is as follows. Following is an example which would delete those records from the table which have age = 25 and then COMMIT the changes in the database.
A COMMIT statement in SQL ends a transaction within a relational database management system (RDBMS) and makes all changes visible to other users. The general format is to issue a BEGIN WORK statement, one or more SQL statements, and then the COMMIT statement.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With