Eddy Macnaghten <eddy@edlsystems.com> writes:
> The other thing to be aware of is if a large number of people are
> writing to the database concurrently it can go wrong (any method). That
> is if you insert a record (using nextval for the sequence), then someone
> else quickly inserts a row too before you have a chance to get the
> sequence number at the next statement then the sequence number you get
> will be wrong (it would be of the new one, not yours). This would be
> the case regardless of how the records are committed.
Not the case. If you use currval(), it will always be the last value
the sequence took *in your session*, so it's immune to other sessions
inserting at the same time. See the docs.
-Doug