Oracle sequence parameters: nextval and currval. Nextval returns the next avaiable sequence value. it returns a unique value every time it is referenced, even for different users. currval obtains the current sequence value. open the first session
ORA-08002: sequence SEQ_WGB_TEST2.CURRVAL not defined in this session
ORA-08002: sequence SEQ_WGB_TEST2.CURRVAL not defined in this session
Environment
Oracle 11.2.0 + SQL Plus
Problem
The following error occurs when querying the current
When I used to write SQL, I always worried that the value of current () would not be absolutely equal to the value I got last time Nextval ().Nextval () can be accessed concurrently by other threads.Let's start with the conclusion:When you get a
Two parameters of the Oracle sequence: Nextval and CurrvalI will use one of the following examples to reflect the difference between the two parametersTo create a sequence:Note: Before calling the value of Currval, you must first call the value of
Application of nextVal and currVal in the database., nextvalcurrval
X. nextVal gets the next sequence value of x sequence, and x. currVal gets the current sequence value of x sequence.
Note:X.CurrVal must be referenced beforeX. NextVal; otherwise, a
Sequence is a sequence of numbers automatically added by a database system in accordance with certain rules. This sequence is generally used as the surrogate primary key (because it is not duplicated) and has no other meaning.Sequence is the
Http://database.51cto.com/art/201108/280742.htm
In the Oracle database , what is a sequence ? What it is used for. A sequence (SEQUENCE) is actually a serial number generator that can automatically generate serial numbers for rows in a table,
In an Oracle database, the purpose of a sequence is to generate a table's primary key value, to be referenced in an INSERT statement, to check the current value through a query, or to increment the sequence to the next value. In this article we
What does Sequence mean?SQL> select * from v $ version where rownum = 1;BANNER--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production the following is an
X.nextval gets the next sequence value of the x sequence, X.currval gets the current sequence value of the x sequence.Note: In reference to X. You must first refer to xbefore currval . Nextval, otherwise the ORA-08002 is reported: The sequence
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.