The view information_schema.sequences contains all sequences defined in the database.
SELECT * FROM information_schema.sequences;
SELECT sequence_schema, sequence_name, current_value FROM information_schema.sequences;
information_schema.sequences
column name | type | remarks |
---|---|---|
sequence_catalog | VARCHAR | Always NULL |
sequence_schema | VARCHAR | |
sequence_name | VARCHAR | |
data_type | VARCHAR | Currently always BIGINT |
numeric_precision | SMALLINT | |
numeric_precision_radix | SMALLINT | |
numeric_scale | SMALLINT | |
start_value | BIGINT | |
minimum_value | BIGINT | |
maximum_value | BIGINT | |
increment | BIGINT | |
cycle_option | VARCHAR | NO or YES |
declared_data_type | VARCHAR | Always NULL |
declared_numeric_precision | SMALLINT | Always NULL |
declared_numeric_scale | SMALLINT | Always NULL |
schema_id | INTEGER | reference to sys.schemas.id |
sequence_id | INTEGER | reference to sys.sequences.id |
current_value | BIGINT | |
cacheinc | BIGINT | cache increment value |
comments | VARCHAR |
Note: The last 5 columns (schema_id, sequence_id, current_value, cacheinc and comments) are extensions to the view as defined by ISO standard. They provide useful information and simplify filtering and joins with system tables/views in sys schema when needed.