Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Commit select-statement ?

Re: Commit select-statement ?

From: Howard J. Rogers <howardjr2000_at_yahoo.com.au>
Date: Tue, 30 Sep 2003 06:32:52 +1000
Message-ID: <3f7897b3$0$28040$afc38c87@news.optusnet.com.au>

Michael Kuznetsov wrote:

> Hi Melanie,
>
> There isn't any reason to commit select statements in oracle at all.
> You only waste time and network traffic. Commit has a sense only after
> insert, update or delete statements (And also not after each
> statement. Only when logic of your program needs it).

Not quite (but mostly). If you do a 'select * from emp for update', then you've only done a select at this stage, but you've also taken locks on every row in the EMP table, with the intention of those rows not changing until after you've performed the update which your select statement indicates you're intending to do.

The only way to get rid of those locks, placed by a select statement, is to commit the select. Feels very odd when you do, because as you say selects don't normally need committing at all. But '...for update' is a different beastie entirely.

Regards
HJR
>
> Regards,
> Michael
> Brainbench MVP for Oracle Programming
> http://www.brainbench.com
>
>
> "Melanie Bieber" <Melanie.Bieber_at_bieber.no-ip.com> wrote in message
> news:<pan.2003.09.28.05.43.46.356127_at_bieber.no-ip.com>...

>> Hello guys,
>> 
>> I am looking for a official statement of oracle,
>> because one of our software developer told me to commit every
>> select-statement.
>> 
>> I think, we don`t have to do that, because you do only a read-only
>> transaction, so where is the reason for this???
>> 
>> Thx4all hints...
>> 
>> Melanie
Received on Mon Sep 29 2003 - 15:32:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US