Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Auto-incrementing primary key?
In article <34BE598E.7468_at_lilly.com> Ed Bradt, ebradt_at_lilly.com writes:
>Sure the user can get CURRVAL but there's no guarantee that someone else
>hasn't made another hit on the sequence in between.
This is not the case.
Within any given session, you can refer to CURRVAL at any time after referring to NEXTVAL. Until that session ends, CURRVAL will *always* contain the last value obtained from NEXTVAL. The only way that it will change is if you refer to NEXTVAL again within the same session, or if the session ends.
This occurs indpenedently of commits, rollbacks, and the activity of other system users.