Re: sequence curval

From: Saad Ahmad <sahmad_at_mfa.com>
Date: 1996/04/26
Message-ID: <4lra4t$sp8_at_homer.alpha.net>#1/1


You have to do seq.nextval to get the next sequence value. The .currval gives you the value for the last .nextval. If you try .currval as the first statement you would get ORA-8002 back.

Hui Li (li_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

--
**************************************************************
*                          Saad Ahmad                        *
*                          Senior Software Engineer          *
*                          McHugh Freeman & Associates, Inc. *
*                          Ph:  (414) 798-7457               *
*                          Fax: (414) 798-8619               *
*                          E-Mail: sahmad_at_mfa.com            *
**************************************************************
Received on Fri Apr 26 1996 - 00:00:00 CEST

Original text of this message