Re: PL/SQL Question

From: Richard Searle <richard_searle_at_cwcom.net>
Date: 2000/04/05
Message-ID: <38eb6461.2007236_at_news.cwcom.net>#1/1


On 4 Apr 2000 09:42:05 +0300, Igor A. Feoktistov <fia_at_ins.dn.ua> wrote:

>K Stahl <BlueSax_at_Unforgetable.com> wrote:
>> amerar_at_unsu.com wrote:
>
>[..]
>
>> Instead of using a "for update" clause, just add the rowid of the row that
>> you wish to update to your select statement and then when you do the update
>> use the rowid in the where clause. That way you avoid all of the locks that
>> are a result of the "for update", yet you still have the speed of not
>> having to look the row up with a value.
>And what would happen when after you fetched row and before you would
>update it someone would delete this row and insert with the same rowid ?

In my experience, update by rowid is by far and away the best way - when I've tried to open a cursor FOR UPDATE it's been the kiss of death. It's true that an unlocked row could theoretically be updated by someone else, but in practice I've only ever wanted to big-cursor-driven updates in batch processes, where the schedule is such that the updating process is the only one with access to the relevant table(s), and when all those pesky online users have gone to bed :-)

Richard Searle
(For my real email address, substitute dot for uscore) Received on Wed Apr 05 2000 - 00:00:00 CEST

Original text of this message