Skip to Main Content

Live SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-02287: sequence number not allowed here.

Good day everyone. Im new to SQL and just starting to learn, but I am getting an error which prevents me from continuing.
I am following a course guide and one of the starting examples was to create a sequence with the name myseq, it should start with the number 1, and increase by 1.
The sequence method nextval should return a numbertype.

So what I did was :
CREATE SEQUENCE myseq
START WITH 1
INCREMENT BY 1;

Which gave me this statement: Sequence MYSEQ created.

All good so far, but my next input gives me an error.
SELECT myseq.NEXTVAL FROM dual;

ORA-02287: sequence number not allowed here

https://docs.oracle.com/error-help/db/ora-02287/

ORA-02287. 00000 - "sequence number not allowed here"
*Cause: The specified sequence number (CURRVAL or NEXTVAL) is inappropriate
here in the statement.
*Action: Remove the sequence number.

Error at Line: 1 Column: 12

When watching my teacher do the solution he does exactly the same as I did, and it worked. Might have been something that changed in newer versions, he uses 19.2 and I use the current r28.1.

Best regards Robin

Comments
Post Details
Added on Apr 7 2025
1 comment
902 views