A sequence is a private database object that can provide a series of integer values. A sequence can be defined as unique or non-unique.
A unique sequence generate unique values. If all values between the initial value and the maximum value has been used, the sequence becomes exhausted and can not be used any more.
A non-unique sequence will generate its series of values repeatedly.
A sequence has an initial value, an increment step value and a maximum value defined when it is created (by using the CREATE SEQUENCE statement).
A sequence is created with an undefined value initially.
It is possible to generate the next value in the integer series of a sequence by using the NEXT_VALUE function, see NEXT_VALUE. When this function is used for the first time after the sequence has been created, it establishes the initial value for the sequence. Subsequent uses will establish the next value in the series of integer values of the sequence as the current value of the sequence.
It is possible to get the current value of a sequence that has been initialized by using the CURRENT_VALUE function, see CURRENT_VALUE. This function cannot be used until the initial value has been established for the sequence (by using NEXT_VALUE for the first time).
An ident must hold USAGE privilege on the sequence in order to use it.
If a sequence is dropped, with the CASCADE option in effect, all objects referencing the sequence will also be dropped.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40