Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Is it possible to use nolock type of hint in query

RE: Is it possible to use nolock type of hint in query

From: Norman Dunbar <>
Date: Mon, 14 Aug 2006 10:44:41 +0100
Message-Id: <>

Morning all,

> "Igor Neyman" <> 08/11/06 08:50pm >>>
> Shouldn't SELECT... FOR UPDATE be used in this case (and not "dirty"
> reads)?


Am I the only DBA in the entire world who disagrees with the use of SELECT ... FOR UPDATE ? To me, this statement is a sure sign of 'lazy developer syndrome' - and having been a developer, don't think I'm having a go at developers in general. (Well, Java developers deserve everything they get, but the rest are ok <GD&R>)

What's wrong with writing correct 'error' handling to get around the fact that some other session has updated your data in the time between your session reading it and then trying to write back the amendments ?

Dave Ensor's book about Oracle Design has a good chapter on this very subject, which basically boils down to 'lock late and lock for a short time only'. SELECT ... FOR UPDATE is a 'lock early and lock for as long as possible' technique.

The number of problems I have to deal with in applications I have supported (and support) which have enqueue problems caused by this very statement is a nightmare. I'm afraid that even Oracle are causing me grief at the moment - in Spatial systems, they have fixed a bug by adding FOR UPDATE to the end of a select from MDSYS.SDO_INDEX_METATDATA_TABLE - unfortunately, one of our systems (web based, Java code, etc etc) takes longer than zero time to do its transaction(s) and locks out other users.



Norman Dunbar.
Contract Oracle DBA.
Rivers House, Leeds.

Internal : 7 28 2051
External : 0113 231 2051

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.

We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at

Received on Mon Aug 14 2006 - 04:44:41 CDT

Original text of this message