Home » SQL & PL/SQL » SQL & PL/SQL » ORA-08002: sequence NAME.CURRVAL is not yet defined in this session
ORA-08002: sequence NAME.CURRVAL is not yet defined in this session [message #209392] Thu, 14 December 2006 09:32 Go to next message
frank.svs
Messages: 162
Registered: February 2006
Senior Member
Hi frns,

I am getting the following error repeatedly eventhough i called the seq.nextval first and then i invoked seq.currval? why?

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


Do i need to set any parameter at database level to persist the
previous nextval of the sequence. Because what i found is that,
the sequence is getting incremented but when i close and open a new session again i am getting the above error.Why?

Because i am facing this error quite oftenly on Production Box.

Waiting for reply.

Thanks and Regards,
frank
Re: ORA-08002: sequence NAME.CURRVAL is not yet defined in this session [message #209393 is a reply to message #209392] Thu, 14 December 2006 09:37 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I'm afraid this is one of those cases where you need to read the error message more closely, and then read your own description of what you're doing, and then go 'Ahhhh!'.

I'll highlight the key points for you:
Error:
ORA-08002: sequence NAME.CURRVAL is not yet defined in this session


And:
but when i close and open a new session again i am getting the above error
Re: ORA-08002: sequence NAME.CURRVAL is not yet defined in this session [message #210717 is a reply to message #209393] Fri, 22 December 2006 00:29 Go to previous messageGo to next message
frank.svs
Messages: 162
Registered: February 2006
Senior Member
But what could be the genuine reason. can you tell me that.

Regards,
franky
Re: ORA-08002: sequence NAME.CURRVAL is not yet defined in this session [message #210722 is a reply to message #210717] Fri, 22 December 2006 01:00 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
No code example. No way to tell you.
Re: ORA-08002: sequence NAME.CURRVAL is not yet defined in this session [message #210723 is a reply to message #210717] Fri, 22 December 2006 01:05 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Have you tried google first?

ORA-08002 name.CURRVAL is not yet defined in this session

Cause: Sequence CURRVAL was selected before sequence NEXTVAL was referenced.

Action: Select NEXTVAL from the sequence before selecting CURRVAL.

By
Vamsi
Re: ORA-08002: sequence NAME.CURRVAL is not yet defined in this session [message #210736 is a reply to message #209392] Fri, 22 December 2006 02:14 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Ok, I'll go through this slowly.

Sequence.CURRVAL only has any meaning in a session if you have previously used NEXTVAL on that sequence in that session.

If you close down your session and open another session, then until you use NEXTVAL in that new session, CURRVAL cannot be used.

You say that
when i close and open a new session again i am getting the above error

This is the reaseon why - you cannot use CURRVAL in a session until you have used NEXTVAL
Re: ORA-08002: sequence NAME.CURRVAL is not yet defined in this session [message #210793 is a reply to message #210736] Fri, 22 December 2006 06:58 Go to previous message
frank.svs
Messages: 162
Registered: February 2006
Senior Member

Now my doubt got cleared.

Thanks Row.

Previous Topic: ABOUT ROWNUM
Next Topic: What is max limit of oracle storage
Goto Forum:
  


Current Time: Thu Dec 08 00:31:25 CST 2016

Total time taken to generate the page: 0.14882 seconds