Note
This view is available starting with V2.2.77.
Purpose
The USER_TAB_COLS view displays all columns of tables and views accessible to the current user.
The USER_TAB_COLS view differs from USER_TAB_COLUMNS in that USER_TAB_COLS displays columns that have been marked for quick drop, while USER_TAB_COLUMNS does not.
Applicability
This view is available starting with OceanBase Database in Oracle mode.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| TABLE_NAME | VARCHAR2(128) | NO | The name of the table or view |
| COLUMN_NAME | VARCHAR2(128) | NO | The name of the column |
| DATA_TYPE | VARCHAR2(128) | NO | The type of the column |
| DATA_TYPE_MOD | VARCHAR2(3) | NO | This column is not supported. It is NULL by default. |
| DATA_TYPE_OWNER | VARCHAR2(128) | NO | This column is not supported. It is NULL by default. |
| DATA_LENGTH | NUMBER | NO | The length of the column, in bytes |
| DATA_PRECISION | NUMBER | NO | The decimal precision of the numeric data type; the binary precision of the floating-point data type; NULL for all other data types |
| DATA_SCALE | NUMBER | NO | The number of digits to the right of the decimal point |
| NULLABLE | VARCHAR2(1) | NO | Indicates whether the column allows NULL values |
| COLUMN_ID | NUMBER | NO | The column number |
| DEFAULT_LENGTH | NUMBER | NO | The default length of the column |
| DATA_DEFAULT | VARCHAR2(128) | NO | The default value of the column |
| NUM_DISTINCT | NUMBER | NO | The number of distinct values in the column |
| LOW_VALUE | VARCHAR2(128) | NO | The minimum value of the column |
| HIGH_VALUE | VARCHAR2(128) | NO | The maximum value of the column |
| DENSITY | NUMBER | NO | The density of the column |
| NUM_NULLS | NUMBER | NO | The number of NULL values in the column |
| NUM_BUCKETS | NUMBER | NO | The number of buckets in the column histogram |
| LAST_ANALYZED | DATE | NO | The date when the column was last analyzed |
| SAMPLE_SIZE | NUMBER | NO | The sample size used for analyzing the column |
| CHARACTER_SET_NAME | VARCHAR2(44) | NO | The character set name: CHAR_CSNCHAR_CS |
| CHAR_COL_DECL_LENGTH | NUMBER | NO | This column is not supported. It is NULL by default. |
| GLOBAL_STATS | VARCHAR2(3) | NO | YES if statistics were collected or incrementally maintained, otherwise NO |
| USER_STATS | VARCHAR2(3) | NO | Indicates whether the statistics were directly input by the user ( YES) or not ( NO) |
| AVG_COL_LEN | NUMBER | NO | The average length of the column, in bytes |
| CHAR_LENGTH | NUMBER | NO | The length of the character column |
| CHAR_USED | VARCHAR2(1) | NO | Indicates whether the column is based on byte length or character length |
| V80_FMT_IMAGE | VARCHAR2(3) | NO | This column is not supported. It is NULL by default. |
| DATA_UPGRADED | VARCHAR2(3) | NO | This column is not supported. It is NULL by default. |
| HIDDEN_COLUMN | VARCHAR2(3) | NO | Indicates whether the column is a hidden column: |
| VIRTUAL_COLUMN | VARCHAR2(3) | NO | Indicates whether the column is a virtual column: |
| SEGMENT_COLUMN_ID | NUMBER | NO | This column is not supported. It is NULL by default. |
| INTERNAL_COLUMN_ID | NUMBER | NO | This column is not supported. It is NULL by default. |
| HISTOGRAM | VARCHAR2(15) | NO | This column is not supported and is NULL by default. |
| QUALIFIED_COL_NAME | VARCHAR2(4000) | NO | Column name with qualification. |
| USER_GENERATED | VARCHAR2(3) | NO | This column is not supported and is set to YES by default. |
| DEFAULT_ON_NULL | VARCHAR2(3) | NO | This column is not supported and is NULL by default. |
| IDENTITY_COLUMN | VARCHAR2(3) | NO | This column is not supported and is NULL by default. |
| EVALUATION_EDITION | VARCHAR2(128) | NO | This column is not supported and is NULL by default. |
| UNUSABLE_BEFORE | VARCHAR2(128) | NO | This column is not supported and is NULL by default. |
| UNUSABLE_BEGINNING | VARCHAR2(128) | NO | This column is not supported and is NULL by default. |
| COLLATION | VARCHAR2(100) | NO | This column is not supported and is NULL by default. |
| COLLATED_COLUMN_ID | NUMBER | NO | This column is not supported and is NULL by default. |
Sample query
Query all columns of tables and views in the database.
obclient [SYS]> SELECT * FROM SYS.USER_TAB_COLS WHERE ROWNUM =1\G
The query result is as follows:
*************************** 1. row ***************************
TABLE_NAME: __idx_15120_idx_data_table_id_real_agent
COLUMN_NAME: TENANT_ID
DATA_TYPE: NUMBER
DATA_TYPE_MOD: NULL
DATA_TYPE_OWNER: NULL
DATA_LENGTH: 22
DATA_PRECISION: 38
DATA_SCALE: 0
NULLABLE: N
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: NULL
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: TENANT_ID
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
1 row in set
References
Query column information of tables and views accessible to the current user: ALL_TAB_COLS
Query column information of all tables and views in the current tenant: DBA_TAB_COLS