Re: Recommendations For Select for Update Statments

  • From: Michael Cunningham <napacunningham@xxxxxxxxx>
  • To: oracle@xxxxxxxxxxxxxxx
  • Date: Tue, 12 Apr 2016 08:18:28 -0700

Hello Walid,

Oracle has something similar to the article mentioned that is built in.
Take a look at ORA_ROWSCN. It also does logical locking vs. physical
locking.

The ORA_ROWSCN is a pseudo column that will change when a row  is updated.
The default behavior is it will be the same for all rows in a block.
However, if the table is build with 'ROW DEPENDENCIES' is will be unique
for every row in the table.

How it works is you would also select the ORA_ROWSCN in your select
statement and then use it again in the update. If there were zero rows
updated then it is because someone else updated the row before you did.

The bad part for either of these solutions is there would be a fair amount
of changes needed to the code to deal with times when the update failed
with zero rows.

Michael

On Tue, Apr 12, 2016 at 4:40 AM, Norman Dunbar <oracle@xxxxxxxxxxxxxxx>
wrote:

This might help. Maybe.

http://qdosmsq.dunbar-it.co.uk/blog/2009/01/lazy-developer-syndrome-and-rowids
/

Cheers,
Norm.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.




-- 
Michael Cunningham

Other related posts: