Re: Sequence curval

From: Thomas J Kyte <tkyte_at_us.oracle.com>
Date: 1996/04/26
Message-ID: <4lqtlq$snt_at_inet-nntp-gw-1.us.oracle.com>#1/1


Shuzi Chen <chen_at_openmarket.com> wrote:

>Sequence vs. identity
> In the Sybase, you can use 'select _at__at_identity'
>to get the identity value used without requiring the transaction. When
>using a sequence we can do
> 'select sequence.curval from dual'
>(Does this require a transaction?, dual is a system table)
>to get the value used. Assume I have two processes;
 

> Process 1 Process 2
> --------- ---------
> insert record
> insert record
> select seq.curval from dual
> select seq.curval from dual
 

>If the second record is inserted before the first process 'select'. What
>curval I will get from procees 1?
>
>
>----------------------------------------------------------------------
>Shuzi Chen
>chen_at_openmarket.com

You will get the currval that was the result of the last nextval YOU issued. You will NOT get someone elses currval. In fact, you cannot even call currval until you have issued a nextval from a sequence.

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government



opinions and statements are mine and do not necessarily reflect the opinions of Oracle Corporation. Received on Fri Apr 26 1996 - 00:00:00 CEST

Original text of this message