A sequence is a database object that provides a series of integer values.
A sequence has a start value, an increment step value and a minimum value and a maximum value defined when it is created (by using the
A sequence can be specified as having a certain data type which will determine the span of possible values for the sequence. The possible data types are
A sequence with
CYCLEoption will generate its series of values repeatedly.
A sequence with
NO CYCLEbecomes exhausted when the end value has been used, and can not be used any more. (An exhausted sequence can be reset using the
A sequence is created with an undefined value initially.
To generate the next value in the integer series of a sequence the
NEXT VALUEfunction is used, see NEXT VALUE. When this expression 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 also possible to get the current value of a sequence by using the
CURRENT VALUEfunction, see CURRENT VALUE. This function can not be used until the initial value has been established for the sequence (by using
NEXT VALUEfor the first time).
If a sequence is dropped with the
CASCADEoption in effect, column defaults referencing the sequence will be removed, but the columns will still exist. Similarly domain defaults referencing the sequence will be removed, but the domains will still exist. Other objects referencing the sequence will be dropped.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40