Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How get the current value from a sequence?
Craig & Co. wrote:
>>"Yes you do. Your statement that Daniel is telling you to >>reconsider is the following: >> >> I believe that executing the command >> select seq_name.nextval from dual; >> does not increment the sequence (the first time), but defines >> the sequence for the session. >> >>This is incorrect, and there is no explanation other than it is >>incorrect." >> >>Thanks Galen. >>-- >>Daniel A. Morgan
You are ignoring advice given to you multiple times, in the group's archives and well documented on many web sites. So here it is again:
CURRVAL only works within the current session following a NEXTVAL.
Once you end the session CURRVAL is meaningless until you again use NEXTVAL which increments the counter yet again.
If you want the current value of a sequence when first logging on the only way to do so is a query against one of the xxx_sequence data dictionary views.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Sun Dec 05 2004 - 21:45:05 CST