Note
This view is introduced since OceanBase Database V4.0.0.
Purpose
The oceanbase.DBA_SEQUENCES view displays all sequences under the current tenant.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| SEQUENCE_OWNER | varchar(128) | NO | The name of the database in which the sequence resides. |
| SEQUENCE_NAME | varchar(128) | NO | The name of the sequence. |
| MIN_VALUE | decimal(28,0) | NO | The minimum value supported. |
| MAX_VALUE | decimal(28,0) | NO | The maximum value supported. |
| INCREMENT_BY | decimal(28,0) | NO | The step size by which the sequence is incremented, which can be a positive or negative integer but cannot be 0. |
| CYCLE_FLAG | varchar(1) | NO | Indicates whether the sequence wraps when it reaches the minimum or maximum value. |
| ORDER_FLAG | varchar(1) | NO | Indicates whether sequence values are generated in order. |
| CACHE_SIZE | decimal(28,0) | NO | The number of sequence values stored in the cache. |
| LAST_NUMBER | decimal(38,0) | NO | The value of the last sequence number written to the disk. |
Sample query
Query all sequences in the current tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_SEQUENCES;
The query result is as follows:
+----------------+---------------+-----------+-----------+--------------+------------+------------+------------+-------------+
| SEQUENCE_OWNER | SEQUENCE_NAME | MIN_VALUE | MAX_VALUE | INCREMENT_BY | CYCLE_FLAG | ORDER_FLAG | CACHE_SIZE | LAST_NUMBER |
+----------------+---------------+-----------+-----------+--------------+------------+------------+------------+-------------+
| infotest | seq1 | 1 | 10 | 2 | N | N | 30 | 1 |
+----------------+---------------+-----------+-----------+--------------+------------+------------+------------+-------------+
1 row in set