Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to use CURRVAL with a sequence generator?
Galen Boyer <galenboyer_at_hotpop.com> wrote in message news:<uzn17cixv.fsf_at_standardandpoors.com>...
> On Wed, 24 Nov 2004, weberm_at_polaris.net wrote:
> > I am attempting to write some PL/SQL which will look at a
> > sequence generator which is used to create receipt numbers and
> > determine if assigning n receipts will exceed its last value
> > (the sequence was created with the NONCYCLE option).
> >
> > However, my attempts to use CURRVAL return some sort of
> > "unidentified value this session" ORACLE exception if I do not
> > use NEXTVAL, yet I am able to see the last value used in TOAD.
> >
> > Is there a way to replicate what I am seeing in TOAD?
>
> It doesn't matter whether it is TOAD, sqlplus, PL/SQL or Larry
> Ellison for that matter. A nextval must be issued for a currval
> to have any meaning. In TOAD's SQL session, somewhere, somehow,
> maybe hidden to you for some odd reason, a nextval was issued.
Or perhaps TOAD is querying ALL_SEQUENCES and displaying LAST_NUMBER. This is not the same as CURRVAL, though it might be close enough for your purposes. Received on Fri Nov 26 2004 - 06:39:26 CST
![]() |
![]() |