Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: reading sequence.CURRVAL
Hi,
another problem might arise with caching the sequence values in SGA. If they are cached, you would 'loose' some values every time you shutdown your db, so that CURRVAL not neccesarily reflects the pk of the last inserted record.
Bill Dietrich schrieb:
>
> I'm using Oracle 7.3..3, and I want my app to check every now and then
> to see if new records have been added to a table (without using
> triggers).
>
> 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.
>
> But the documentation says "Note that before you use CURRVAL
> for a sequence in your session, you must first initialize
> the sequence with NEXTVAL." And it is true; I've tested it.
>
> This means that I can't just read CURRVAL; first I have to
> reference NEXTVAL, which increments the value ! I don't want
> to do this.
>
> Is there any other way to read CURRVAL without changing its value ?
>
> I can't believe sequences have this behavior !
>
> Bill Dietrich
> bill_dietrich_at_wayfarer.com
--
Regards
Matthias Gresz :-)
GreMa_at_t-online.de Received on Fri Apr 24 1998 - 04:39:57 CDT