Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!news.germany.com!feeder.xsnews.nl!sn-ams-06!sn-xt-ams-03!sn-post-ams-01!supernews.com!corp.supernews.com!not-for-mail
From: Sybrand Bakker <postbus@sybrandb.demon.nl>
Newsgroups: comp.databases.oracle.server
Subject: Re: sequence concurrency question
Date: Fri, 05 May 2006 20:05:46 +0200
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <vs4n52pmdu71ff8lj16vhoutl8ee5stplj@4ax.com>
Reply-To: sybrandb@hccnet.verwijderdit.nl
References: <1146847762.940067.118520@g10g2000cwb.googlegroups.com>
X-Newsreader: Forte Agent 3.3/32.846
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@supernews.com
Lines: 13
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.server:266971

On 5 May 2006 09:49:22 -0700, amit.varde@gmail.com wrote:

>tran_id is being populated using a sequence number.
>The prnt_id col is supposed to contain a 0 for the parent record
>and the tran_id for the children records

so resolve this using a before insert for each row trigger on the
table instead of the code you presented which is doomed to fail.
There is no guarantee the sequence is not incremented between your two
accesses of it.

--
Sybrand Bakker, Senior Oracle DBA
