Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: reading sequence.CURRVAL
It is true that sequences are not rolled back. The alternate solution to this
issue is to do a
SELECT MAX(ID) from TABLE;
Good luck,
CM
In article <01bd72c6$4b8af190$0c5dc584_at_buggs>#1/1,
"GTE Labs" <ll01_at_gte.com> wrote:
>
> I don't think you can use this approach reliably anyway. What if
> myseq.NEXTVAL
> succeeds but the row insertion fails? I don't think that sequences are
> rolled back
> in Oracle.
>
> Bill Dietrich <bill_dietrich_at_wayfarer.com> wrote in article
> <353F99E3.8CBA4271_at_wayfarer.com>...
> > 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
> >
> >
> >
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Thu Apr 30 1998 - 12:20:10 CDT
![]() |
![]() |