Xref: alice comp.databases.oracle.server:60826
Path: alice!news-feed.fnsi.net!netnews.com!newsfeed.berkeley.edu!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!inet16.us.oracle.com!not-for-mail
From: tkyte@us.oracle.com (Thomas Kyte)
Newsgroups: comp.databases.oracle.server
Subject: Re: newbe concurrency question
Date: Sun, 08 Aug 1999 14:37:33 GMT
Organization: Oracle Service Industries
Lines: 49
Message-ID: <37b49614.8415741@newshost.us.oracle.com>
References: <7o4rg3$6dq$1@news.xmission.com>
Reply-To: tkyte@us.oracle.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: inet16.us.oracle.com 934122886 19009 130.35.30.103 (8 Aug 1999 14:34:46 GMT)
X-Complaints-To: usenet@inet16.us.oracle.com
NNTP-Posting-Date: 8 Aug 1999 14:34:46 GMT
X-Newsreader: Forte Agent 1.5/32.451

A copy of this was sent to "Justin Call" <justin@thoughtstar.com>
(if that email address didn't require changing)
On Mon, 2 Aug 1999 13:28:49 -0600, you wrote:

>All-
>
>Lets say that I have several webservers running servlets using JDBC to
>connect to an oracle database (8i for example).  If I repeatedly execute the
>following on all "clients":
>
>INSERT INTO SOMETABLE (SOMEINTCOLUMN) VALUES (SELECT FROM SOMETABLE
>MAX(SOMEINTCOLUMN));
>
>Do I ever duplicate values in SOMECOLUMN? 

absolutely you will.

Unless you have a primary key (or unique) constraint on SOMEINTCOLUMN -- then
everyone will wait in line and some people will succeed and some will perhaps
fail.

You might consider looking at sequences and instead:

insert into sometable ( someintcolumn ) values ( your_sequence.nextval );

> If so, is the same true if the
>database is replicated using parallel server?
>

OPS is not a replication implementation.  Its a single copy of a database opened
by many instances on different machines.  it would see the same things as above.
again, a sequence would be the best way to do this.

>Any help would be much appreciated!
>
>-Justin
>
>
>


-- 
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
 
Thomas Kyte                   tkyte@us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation
