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

Home -> Community -> Usenet -> c.d.o.misc -> Re: A Typical Concurrent Access Problem

Re: A Typical Concurrent Access Problem

From: AK <AK_TIREDOFSPAM_at_hotmail.COM>
Date: 9 Jun 2005 07:14:12 -0700
Message-ID: <1118326452.473575.54610@o13g2000cwo.googlegroups.com>


let's say you have 1000 storage spaces in the warehouse, and the space number 1000 is always used. Your approach won't let you use spaces 1-999, correct? Probably your solution does not work.

I would

  1. a table to serialize on

create table serializer(toggle number(1)); insert into serializer values(1);

2. have a table for storage spaces
create table storage(space_num number, used_by varchar2(50));
--- populate it

---reusing available space
--- 1. serialize

update serializer set toggle = 1 - toggle;
--- this acquires an update lock on the modified row

update storage set used_by='somebody' where space_num = (select min(space_num) into v_unused_num from storage where used_by is null);

commit;
--- update lock released, another request may proceed
Received on Thu Jun 09 2005 - 09:14:12 CDT

Original text of this message

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