ORA-08002 Error Message
Learn the cause and how to resolve the ORA-08002 error message in Oracle.
Description
When you encounter an ORA-08002 error, the following error message will appear:
- ORA-08002: sequence NAME.CURRVAL is not yet defined in this session
Cause
You tried to execute a CURRVAL command on a sequence before the NEXTVAL command was executed at least once.
Resolution
The option(s) to resolve this Oracle error are:
Option #1
Try executing the NEXTVAL command for the sequence, initially. Then call the CURRVAL command.
For example, if you created the following sequence.
CREATE SEQUENCE supplier_seq MINVALUE 1 MAXVALUE 999999999999999999999999999 START WITH 1 INCREMENT BY 1 CACHE 20;
Then tried to call the CURRVAL command for this sequence:
SELECT supplier_seq.CURRVAL FROM dual;
You would receive the following error message:
Your sequence does not yet have a value until you call the NEXTVAL command at least once as follows:
SELECT supplier_seq.NEXTVAL FROM dual;
Now your sequence has a value assigned to it, so it is okay to execute the CURRVAL command, as follows:
SELECT supplier_seq.CURRVAL FROM dual;
No comments:
Post a Comment