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.