Note
This view is available starting with V4.0.0.
Purpose
This view displays column information of tables and views of all tenants. This view is consistent with the CDB_TAB_COLS_V$ view, except that it does not contain the NOTES column, which is not currently used.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| CON_ID | bigint(20) | NO | Tenant ID |
| OWNER | varchar(128) | NO | The owner of the table, view, or cluster. |
| TABLE_NAME | varchar(128) | NO | The name of the table, view, or cluster. |
| COLUMN_NAME | varchar(128) | NO | The column name. |
| DATA_TYPE | varchar(128) | NO | The data type of the column. |
| DATA_TYPE_MOD | varchar(3) | NO | NULL by default |
| DATA_TYPE_OWNER | varchar(128) | NO | NULL by default |
| DATA_LENGTH | bigint(21) | NO | The length of the column, in bytes. |
| DATA_PRECISION | bigint(20) | NO | The decimal precision of the NUMBER data type; the binary precision of the FLOAT data type; NULL for all other data types. |
| DATA_SCALE | bigint(20) | NO | The number of digits to the right of the decimal point. |
| NULLABLE | varchar(1) | NO | Indicates whether the column allows NULL values. This value indicates whether the column has a NOT NULL constraint or whether the column is part of a PRIMARY KEY. |
| COLUMN_ID | bigint(20) | NO | The sequence number of the created column. |
| DEFAULT_LENGTH | bigint(20) | NO | The length of the column's default value. |
| DATA_DEFAULT | mediumtext | NO | The default value of the column. |
| NUM_DISTINCT | bigint(20) | NO | The number of distinct values in the column. |
| LOW_VALUE | varchar(128) | NO | The minimum value of the column. |
| HIGH_VALUE | varchar(128) | NO | The maximum value of the column. |
| DENSITY | bigint(21) | NO | The density of the column. |
| NUM_NULLS | bigint(20) | NO | The number of NULL values in the column. |
| NUM_BUCKETS | bigint(20) | NO | The number of buckets in the histogram of the column. |
| LAST_ANALYZED | date | NO | The date when the column was last analyzed. |
| SAMPLE_SIZE | bigint(20) | NO | The sample size used to analyze the column. |
| CHARACTER_SET_NAME | varchar(44) | NO | The character set name:
|
| CHAR_COL_DECL_LENGTH | bigint(0) | NO | NULL by default |
| GLOBAL_STATS | varchar(3) | NO | YES if statistics were collected or incrementally maintained, otherwise NO. |
| USER_STATS | varchar(3) | NO | Indicates whether the statistics were directly entered by the user ( YES) or not ( NO). |
| AVG_COL_LEN | bigint(21) | NO | The average length of the column, in bytes. |
| CHAR_LENGTH | bigint(20) | NO | The length of the column, displayed in characters. This value applies only to the following data types:
|
| CHAR_USED | varchar(1) | NO | Indicates the length semantics used for the column: BYTE (B) or CHAR (C). If the column is not of the following data types, the value is NULL:
|
| V80_FMT_IMAGE | varchar(3) | NO | Default value is NULL |
| DATA_UPGRADED | varchar(3) | NO | Default value is NULL |
| HIDDEN_COLUMN | varchar(3) | NO | Indicates whether the column is a hidden column ( YES) or not ( NO) |
| VIRTUAL_COLUMN | varchar(3) | NO | Indicates whether the column is a virtual column ( YES) or not ( NO) |
| SEGMENT_COLUMN_ID | bigint(0) | NO | Default value is NULL |
| INTERNAL_COLUMN_ID | bigint(0) | NO | Default value is NULL |
| HISTOGRAM | varchar(15) | NO | Indicates the existence or type of histogram:
|
| QUALIFIED_COL_NAME | text | NO | The qualified column name |
| USER_GENERATED | varchar(3) | NO | Indicates the generation attribute of the column. Valid values:
|
| DEFAULT_ON_NULL | varchar(3) | NO | Default value is NULL |
| IDENTITY_COLUMN | varchar(3) | NO | Default value is NULL |
| EVALUATION_EDITION | varchar(128) | NO | Default value is NULL |
| UNUSABLE_BEFORE | varchar(128) | NO | Default value is NULL |
| UNUSABLE_BEGINNING | varchar(128) | NO | Default value is NULL |
| COLLATION | varchar(100) | NO | Default value is NULL |
| COLLATED_COLUMN_ID | bigint(0) | NO | Default value is NULL |
Sample query
In the sys tenant, query the column information of the t1 table in the tenant whose ID is 1002.
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_TAB_COLS WHERE CON_ID=1002 AND TABLE_NAME='t1'\G
The query result is as follows:
*************************** 1. row ***************************
CON_ID: 1002
OWNER: infotest
TABLE_NAME: t1
COLUMN_NAME: c1
DATA_TYPE: NUMBER
DATA_TYPE_MOD: NULL
DATA_TYPE_OWNER: NULL
DATA_LENGTH: 0
DATA_PRECISION: 11
DATA_SCALE: 0
NULLABLE: Y
COLUMN_ID: 16
DEFAULT_LENGTH: NULL
DATA_DEFAULT: NULL
NUM_DISTINCT: NULL
LOW_VALUE: NULL
HIGH_VALUE: NULL
DENSITY: NULL
NUM_NULLS: NULL
NUM_BUCKETS: NULL
LAST_ANALYZED: NULL
SAMPLE_SIZE: NULL
CHARACTER_SET_NAME:
CHAR_COL_DECL_LENGTH: NULL
GLOBAL_STATS: NULL
USER_STATS: NULL
AVG_COL_LEN: NULL
CHAR_LENGTH: 0
CHAR_USED: NULL
V80_FMT_IMAGE: NULL
DATA_UPGRADED: NULL
HIDDEN_COLUMN: NO
VIRTUAL_COLUMN: NO
SEGMENT_COLUMN_ID: NULL
INTERNAL_COLUMN_ID: NULL
HISTOGRAM: NULL
QUALIFIED_COL_NAME: c1
USER_GENERATED: YES
DEFAULT_ON_NULL: NULL
IDENTITY_COLUMN: NULL
EVALUATION_EDITION: NULL
UNUSABLE_BEFORE: NULL
UNUSABLE_BEGINNING: NULL
COLLATION: NULL
COLLATED_COLUMN_ID: NULL
*************************** 2. row ***************************
CON_ID: 1002
OWNER: infotest
TABLE_NAME: t1
COLUMN_NAME: c2
DATA_TYPE: NUMBER
DATA_TYPE_MOD: NULL
DATA_TYPE_OWNER: NULL
DATA_LENGTH: 0
DATA_PRECISION: 11
DATA_SCALE: 0
NULLABLE: Y
COLUMN_ID: 17
DEFAULT_LENGTH: NULL
DATA_DEFAULT: NULL
NUM_DISTINCT: NULL
LOW_VALUE: NULL
HIGH_VALUE: NULL
DENSITY: NULL
NUM_NULLS: NULL
NUM_BUCKETS: NULL
LAST_ANALYZED: NULL
SAMPLE_SIZE: NULL
CHARACTER_SET_NAME:
CHAR_COL_DECL_LENGTH: NULL
GLOBAL_STATS: NULL
USER_STATS: NULL
AVG_COL_LEN: NULL
CHAR_LENGTH: 0
CHAR_USED: NULL
V80_FMT_IMAGE: NULL
DATA_UPGRADED: NULL
HIDDEN_COLUMN: NO
VIRTUAL_COLUMN: NO
SEGMENT_COLUMN_ID: NULL
INTERNAL_COLUMN_ID: NULL
HISTOGRAM: NULL
QUALIFIED_COL_NAME: c2
USER_GENERATED: YES
DEFAULT_ON_NULL: NULL
IDENTITY_COLUMN: NULL
EVALUATION_EDITION: NULL
UNUSABLE_BEFORE: NULL
UNUSABLE_BEGINNING: NULL
COLLATION: NULL
COLLATED_COLUMN_ID: NULL
2 rows in set