Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Reading records in a multi-threaded environment..
Hi,
I am trying to read rows from a table from different threads simutaniously. Each thread should get a different row based on some id, say, max(timestamp, begins a transaction, does some work and commits the transaction. How do I prevent other threads from reading the same thread or from blocking on read while one thread is processing a row?
Sample table 'X' looks like: (id char(10) not null, count int not null)
and there are 100 rows with counts from 1-100;
Each thread's code looks like:
begin transaction
read a row with max(count);
hold lock on max(count);
do some work;
delete the row;
commit transaction
Ideally, first thread should get hold of row with count = 100, second with count = 99 etc.. *simultaniously*.
Thanks for your time.
Please Cc: your response to "kolli_s_at_hotmail.com"
-Sudhir
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Thu Nov 19 1998 - 00:00:00 CST