Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Getting current sequence value

Re: Getting current sequence value

From: Doug Cowles <dcowles_at_bigfoot.com>
Date: Mon, 29 Mar 1999 10:11:15 -0500
Message-ID: <36FF9813.8650955C@bigfoot.com>


The problem with using select sequence.currval is that you have to call nextval to begin with. As a rule, the sequence cannot be incremented for what I need to do, so currval and nextval aren't options. Someone sent me a note suggesting last_number in the user_sequence view, but it seems to be that this is not really the last_number, but the nextnumber, for if you select a .nextval you get the number you just got for last_number. As a rule, does anyone know wether this is true?

> I agree about caching, if caching is enabled the number of values cached is
> the number of values in play.They are available to any and all transactions
> and in those cases where a transaction is rolled back or whatever, the
> Sequence values will be used in turn. To eliminate this problem set CACHE =
> 0.
>
> Mike Rose
>
> Philip Chee <philip_at_aleytys.pc.my> wrote in message
> news:922676424.4547snx_at_aleytys.pc.my...
> > In article <36FECA76.A2A8D15A_at_bigfoot.com> dcowles_at_bigfoot.com writes:
> >
> > >Is there any way to get the current value of a sequence number without
> > >incrementing it? You can't use currval unless you define the sequence
> > >for the session by calling nextval first. Is there any way around this?
> >
> > You might look at dictionary views such as DBA_SEQUENCES or
> > USER_SEQUENCES. Whether the data you get back is valid is another matter
> > though. I suspect that if the sequence is cached CURVAL will not be
> > accurate.
> >
> > Philip
> >
> > ---=====================================================================--
> -
> > Philip Chee: Tasek Corporation Berhad, P.O.Box 254, 30908 Ipoh, MALAYSIA
> > e-mail: philip_at_aleytys.pc.my Voice:+60-5-545-1011 Fax:+60-5-547-3932
> > Guard us from the she-wolf and the wolf, and guard us from the thief,
> > oh Night, and so be good for us to pass.
> > ---
> > þ 10075.50 þ New Mail not found. Executing Blame Sysop Sequence...
Received on Mon Mar 29 1999 - 09:11:15 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US