Sorry, didn't mean to give false info, I did send a private message to Mike
Lacey after his private reply stating that I wasn't sure if it's serialized
between transactions, though I always used a variable value in my
applications.

Ilya Sterin

-----Original Message-----
From: Stephen Clouse
To: Sterin, Ilya
Cc: 'Nico van Leeuwen '; '[EMAIL PROTECTED] '
Sent: 05/14/2001 12:21 PM
Subject: Re: Oracle auto_increment

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, May 14, 2001 at 10:52:28AM -0600, Sterin, Ilya wrote:
> In Oracle you must run the "select increment_name.nextval from dual"
query
> and then fetch from it to retrieve the row, you can then use that
value for
> all of your inserts.  I wouldn't recommend using *curval* since if you
want
> to make sure inserts are in order, some simultaneous transactions
might
> process before you retrive curval and therefore the insert will fail.

Arg...quit spreading that falsehood.  <sequence>.currval is serialized
between
transactions.  You will always get the last value returned to your
current
transaction, even if the sequence has moved on at the global level.
There is
no race condition like you describe.

In short, use currval -- it is your (much simpler) friend.

- -- 
Stephen Clouse <[EMAIL PROTECTED]>
Senior Programmer, IQ Coordinator Project Lead
The IQ Group, Inc. <http://www.theiqgroup.com/>

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBOwAiPQOGqGs0PadnEQJ0qQCglihJ6Het7RbGoIRYLaxBacRKON8An0v3
GkBYM5aJN5Y9lhufL5SRrxst
=6RQ9
-----END PGP SIGNATURE-----

Reply via email to