I am using SQL workshop available on apex.oracle.com.
I create a sequence named: emp_SK
Create sequence emp_SK;
I use this sequence to add few records into employees table. I log out and log in again. Then I issue:
Select emp_sk.currval from dual;
It gives me an error: currval not yet defined in this session. I can understand this because I am referencing currval before referencing nextval in my session.
Then I issue:
Select emp_SK.currval, emp_SK.nextval from dual;
It gives me output as 8 for both the columns
Then i again issue the following statement in the same session
Select emp_SK.currval from dual;
I get the same error : currval not yet defined in the session.
Why it is giving me an error? Did not I just referenced the nextval?
Yes, but you're not using the same session: APEX uses connection pooling.