"Mark J. Bobak" wrote:
> 
> Um, no.  Select for update will lock whatever rows it selects.  If it
> happens to select all the rows in a table, then all the rows in the
> table will be locked.  But, you could select for update where
> primary_key=1 and select (and lock) just one row.  As with other DML
> locks, the lock will be released when you commit or rollback.
> 
> See the concepts manual for more details.
> 
> Hope that helps,
> 
> -Mark
> 
> On Fri, 2002-09-27 at 20:33, tony ynot wrote:
> > Is Select ... For Update;
> > a cheap table lock?
> > It seems whenever code uses this statement
> > all the records in the cursor are locked
> > until the cursor is closed.
> >

IMHO SELECT .. FOR UPDATE is something which, in most cases where I see
it used, is perfectly dispensable. It's a relic of Oracle 5 when there
was no real row lock (only exclusive table locks and 'intent' row locks)
and the difficulty was to hold them for as short a period as possible -
hence SELECT ... FOR UPDATE to get the rowid, then a very fast UPDATE
using the rowid and commit. Since Oracle6, unless you intend to
'reserve' a row, run a 3 hours process and be certain to find the same
value when you're done, you can directly execute the update, it will
spare you a select.
-- 
Regards,

Stephane Faroult
Oriole Software
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to