Re: don't use all_sequences !

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Sun, 2 Aug 1998 09:46:19 +0200
Message-ID: <6q15fk$8a7$1_at_newton.a2000.nl>


>An other method, not for this problem, is, using the Value-Column from
>ALL_SEQUENCES where the SEQ-NAME is your Sequence.

No!

This is only true if you use increment by 1. Otherwise Oracle will cache your numbers, reflecting the highest number which is cached in the value column, not the last number that has you just used! Even when increment by = 1, you have to be sure that no other sessions are using the sequence, as otherwise you may see the number of the other session, not the number your session recently used. This may also apply for using currval.

You'd better keep it save, and simply use an extra variable.

Arjan. Received on Sun Aug 02 1998 - 09:46:19 CEST

Original text of this message