Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: reading sequence.CURRVAL
Bill,
Jonathan's right: cached sequence values may be lost.
Moreover, a sequence will advance even if a transaction
that uses the sequence happens to get rolled back.
So there are holes in your scheme, and you cannot
*rely* on sequences to do what you say you want to do.
Better design would be to timestamp new (and/or
updated) records. If you put an index on the timestamp
column, you will be able to fetch relatively quickly
all new (and/or updated) rows as of a date specified,
even if your table has many rows. And such a timestamp
could prove useful for a variety of reasons.
Tim Romano
Jonathan Gennick wrote:
>
> On Thu, 23 Apr 1998 12:43:31 -0700, Bill Dietrich
> <bill_dietrich_at_wayfarer.com> wrote:
>
> >What I'd like to do is just read sequence.CURRVAL, where
> >this is a sequence that generates record IDs for the table. If CURRVAL
> >has
> >increased since the last time I read it, I know there are new records,
> >and what range their IDs are in.
>
> I'm not sure that you can always count on this. We sometimes
> get gaps. I think that in the event of a crash that you will
> lose the sequences that Oracle has cached.
Received on Fri Apr 24 1998 - 15:01:16 CDT
![]() |
![]() |