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: C/S Concurrency issue

Re: C/S Concurrency issue

From: Eugen Nyffeler <eugen.nyffeler_at_ubs.com>
Date: Tue, 12 May 1998 12:25:10 +0200
Message-ID: <35582384.FED4C3B8@ubs.com>


D.W. Hoellein wrote:
>
> Our C/S system requires a unique id for each top-level object inserted
> into a table. We're using ODBC and are trying to stay fairly generic in
> our code, so we are maintaining the current id ourselves and
> incrementing as we insert new records.
>
> Currently we SELECT the current id value, then UPDATE it to increment it
> for the next time. We have the problem of Client #1 obtaining the
> current value of N, but before it can UPDATE it to N+1, Client #2 also
> obtains the id of N. How can we insure that only one client will get a
> given value, without any other client getting it before the UPDATE
> occurs?
>
> Thanks in advance!
>
> Don Hoellein
> Mantra Software Corp.

Hi Don

Have a look at sequences. If you can afford to have gaps in your id, then this would
be the solution. If you don't like sequences try to create a table with the
"sequence number" and do a select for update on this table.

HtH
eugen Received on Tue May 12 1998 - 05:25:10 CDT

Original text of this message

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