Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: several process collide when updating one table
mod is the Oracle modulo function.
e.g. select mod(10,3) from dual should yield 1.
Jim
"Colin McKinnon" <colin_at_EditMeOutUnlessYoureABot.wew.co.uk> wrote in message
news:3ss5k9.cnk.ln_at_Lonmay.wew.co.uk...
> M. Weiss <weiss_at_virtual7.de> wrote in message
> news:3b65ac18$1_at_netnews.web.de...
> > Ok... the problem which occurred was, that during selecting and updating
from
> > one process, a second process selected the same item and did also his
job
with
> > that row. So I decided to go another way:
> >
> The first thing to do is to identify whether you need to update records
one
> at a time. Using SQL to update a set of records is far more efficient and
a
> LOT faster. You'll also be able to use locking to solve your problem.
>
> If you can enumerate your processes (i.e. give them each a unique
sequential
> number starting at 0) then you can preflag all the records for each
process
> (can't remember how oracle does modulo - using % in below) e.g.
>
>
> UPDATE myrecords SET processor = rownum % $max_number_of_proc;
>
> Then instead of selecting all records, select those which have been
> preflagged for the process:
>
> SELECT * FROM myrecords WHERE procesor = $proc_enum;
>
> Preflagging a single record isn't going to much help.
>
> HTH
>
> Colin
>
>
Received on Tue Jul 31 2001 - 20:14:33 CDT
![]() |
![]() |