Any Idea On H2 (Oracle MODE) "Syntax Error : SELECT NEXTVAL FROM[*] DUAL"?


Answer :

Please ensure the sequence is created. If it is created, then it works for me:

create sequence SQ_PERSON_ID; select SQ_PERSON_ID.nextval from dual; 

If it is not created, then the same error message is thrown as you got.


I was working on h2 with Oracle mode but all the above solutions mentioned above didn't work for me. Although after some research I found that this query will work fine for fetching the next value in the sequence.

select nextval('SchemaName', 'SequenceName');


Check if you use the same schema under which the sequence is created. If not, insert a schema prefix before sequence name, such is MYUSER.MY_SEQ.


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?