A sequence — or generator — is a database object used to get unique number values to fill a series.“Sequence” is the SQL-compliant term for the same thing which — in Firebird — has traditionally been known as “generator”.Firebird has syntax for both terms.
Sequences are always stored as 64-bit integers, regardless of the SQL dialect of the database.
Caution
|
If a client is connected using Dialect 1, the server handles sequence values as 32-bit integers.Passing a sequence value to a 32-bit field or variable will not cause errors as long as the current value of the sequence does not exceed the limits of a 32-bit number.However, as soon as the sequence value exceeds this limit, a database in Dialect 3 will produce an error.A database in Dialect 1 will truncate (overflow) the value, which could compromise the uniqueness of the series. |
This section describes how to create, alter, set and drop sequences.