CREATE OR ALTER SEQUENCE
Creates a sequence if it doesn’t exist, or alters a sequence
DSQL, ESQL
CREATE OR ALTER {SEQUENCE | GENERATOR} seq_name {RESTART | START WITH start_value} [INCREMENT [BY] increment]
Parameter | Description |
---|---|
seq_name |
Sequence (generator) name.The maximum length is 63 characters |
start_value |
Initial value of the sequence.Default is 1. |
increment |
Increment of the sequence (when using |
If the sequence does not exist, it will be created.An existing sequence will be changed:
-
If
RESTART
is specified, the sequence will restart with the initial value stored in the metadata -
If the
START WITH
clause is specified, the sequence is restarted with start_value, but the start_value is not stored.In other words, it behaves asRESTART WITH
in [fblangref50-ddl-sequence-alter]. -
If the
INCREMENT [BY]
clause is specified, increment is stored as the increment in the metadata, and used for subsequent calls toNEXT VALUE FOR