Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: several process collide when updating one table

Re: several process collide when updating one table

From: Jim Kennedy <kennedy-family_at_home.com>
Date: Wed, 01 Aug 2001 01:14:33 GMT
Message-ID: <ZJI97.416699$p33.8434381@news1.sttls1.wa.home.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US