Tuesday, November 29, 2011

Using Nextval and Currval for Sequences

I was accessing a sequence HZ_PARTY_NUMBER_S from my APPS schema. when I executed the query it gave me the error:

SQL> SELECT hz_party_number_s.nextval FROM DUAL;

ORA-08002: sequence HZ_PARTY_NUMBER_S.CURRVAL is not yet defined in this session


After a couple of hit s on Google i learned that: "To access a sequence for the first time, you must refer to sequence.NEXTVAL before you can refer to sequence.CURRVAL. The first reference to NEXTVALreturns the initial value of the sequence."


also given were much useful info regarding sequences. so here you go:
http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls1016.htm

All the best with your sequences!

No comments:

Post a Comment