SEQUENCES
Displays information about sequences.
Column Name | Data Type | Description |
---|---|---|
SEQUENCE_NAMESPACE |
VARCHAR | For Eon Mode databases, name of the namespace that contains the sequence. |
SEQUENCE_SCHEMA |
VARCHAR |
The name of the schema that contains the sequence. If the schema belongs to a non-default namespace in an Eon Mode database, the schema name is front-qualified with the name of the schema's namespace. For example, |
SEQUENCE_NAME |
VARCHAR |
One of the following:
|
OWNER_NAME |
VARCHAR |
One of the following:
|
IDENTITY_TABLE_NAME |
VARCHAR | Set only for IDENTITY column sequences, name of the column table. |
SESSION_CACHE_COUNT |
INTEGER | Count of values cached in a session. |
ALLOW_CYCLE |
BOOLEAN | Whether values cycle when a sequence reaches its minimum or maximum value, as set by CREATE SEQUENCE parameter CYCLE|NO CYCLE. |
OUTPUT_ORDERED |
BOOLEAN | Values guaranteed to be ordered, always false. |
INCREMENT_BY |
INTEGER | Value by which sequences are incremented or decremented. |
MINIMUM |
INTEGER | Minimum value the sequence can generate. |
MAXIMUM |
INTEGER | Maximum value the sequence can generate. |
CURRENT_VALUE |
INTEGER | How many sequence numbers are distributed among all cluster nodes. |
SEQUENCE_SCHEMA_ID |
INTEGER | Unique numeric catalog ID of the sequence schema. |
SEQUENCE_ID |
INTEGER | Unique numeric catalog ID of the sequence. |
OWNER_ID |
INTEGER | Unique numeric catalog ID of the user who created the sequence. |
IDENTITY_TABLE_ID |
INTEGER | Set only for IDENTITY column sequences, unique numeric catalog ID of the column table. |
Examples
Create a sequence:
Return information about this sequence:
IDENTITY columns are sequences that are defined in a table's DDL. IDENTITY column values automatically increment as new rows are added. To identify IDENTITY columns and their tables, query the system table
COLUMNS
:
Query SEQUENCES
to get detailed information about the IDENTITY column sequence in employees
:
Use the vsql command \ds
to list all named and IDENTITY column sequences. The following results show the two sequences created previously:
Note
The CurrentValue of both sequences is one less than its start number—0 and 149 for the IDENTITY column employeeID
and named sequence my_seq
, respectively:
employeeID
's start number—by default set to 1 because the table DDL did not specify otherwise—is set to 0 because no rows have yet been added to theemployees
table.my_seq
is set to 149 because NEXTVAL has not yet been called on it.