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

Home -> Community -> Usenet -> c.d.o.tools -> several perl-processes updating one table -> collision

several perl-processes updating one table -> collision

From: M. Weiss <weiss_at_virtual7.de>
Date: 30 Jul 2001 20:47:43 +0200
Message-ID: <3b65abcf$1@netnews.web.de>

Hi people,

I got a tiny little problem with perl, working on an ORA-DB. I start several (up to 8) perl-processes which all work on one table. Each process among them shall be able to read a row from the table, mark it as processed and work down what ever to do. First I tried to do it the following way:

  1. select the next item from table
  2. update this row to mark it as processed.

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:

  1. update the next item from table with an unique id (pid of perl-process) using the following statement:
    "update test set processed=[pid] where processed=0 and rownum between 0 and 1"
  2. select all information from this row:
    "select * from test where processed=[pid]"
  3. and update it to be done:
    "update test set processed=1 where processed=[pid]"

Well... the number of collisions was hardly reduced, but in the end there still remained some collisions.

Now my question is: What to do in this case... ? Doesn't Oracle manage those update-statements in a sequential way ?

Hopin' for any ideas...

Regards.
Marcus

-- 
__________________________________________________________
News suchen, lesen, schreiben mit http://newsgroups.web.de
Received on Mon Jul 30 2001 - 13:47:43 CDT

Original text of this message

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