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: Ram Varra <ram.r.varra_at_intel.com>
Date: Thu, 14 May 1998 21:56:59 -0700
Message-ID: <6jfpfe$m59$1@scnews.sc.intel.com>


Try:

  1. Select for update to retrieve the id with a lock, and update it to increement. or
  2. Use a PL/SQL function that updates and returns the value.

Ram Varra

D.W. Hoellein wrote in message <3557D8C7.3FB1FDC4_at_kersur.net>...
>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.
Received on Thu May 14 1998 - 23:56:59 CDT

Original text of this message

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