ORA-08002: sequence SEQ_WGB_TEST2.CURRVAL not defined in this session

Source: Internet
Author: User
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 Sequence value:

SQL> SELECT seq_WGB_Test2.CURRVAL FROM dual;

SELECT seq_WGB_Test2.CURRVAL FROM dual

*
Row 3 has an error:

ORA-08002: sequence SEQ_WGB_TEST2.CURRVAL not defined in this session

Solution

First, create a test sequence:

SQL> CREATE SEQUENCE seq_WGB_Test2
2 increment by 1
3 start with 1000;

The sequence has been created.

Then query the current value:

SQL> SELECT seq_WGB_Test2.CURRVAL FROM dual;
SELECT seq_WGB_Test2.CURRVAL FROM dual
*
Row 3 has an error:
ORA-08002: sequence SEQ_WGB_TEST2.CURRVAL not defined in this session

Call NEXTVAL to query the current value again:

SQL> SELECT seq_WGB_Test2.NEXTVAL FROM dual;

NEXTVAL
----------
1000

SQL> SELECT seq_WGB_Test2.CURRVAL FROM dual;

CURRVAL
----------
1000

SQL>

An error occurs when you directly query the current value (CURRVAL) of a Sequence. You must call the Sequence object. NEXTVAL to query the current value. Note: Oracle is case insensitive to object names.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.