Note
This view is available starting with V2.2.30.
Purpose
This view displays the column information of constraints on all tables owned by the user.
Applicability
This view applies only to OceanBase Database in Oracle mode.
Columns
| Column | Type | Can the field be NULL | Description |
|---|---|---|---|
| OWNER | VARCHAR2(128) | VARCHAR2(128) | The owner of the column. |
| CONSTRAINT_NAME | VARCHAR2(128) | NO | The name of the constraint. |
| TABLE_NAME | VARCHAR2(128) | NO | The name of the table where the constraint is located. |
| COLUMN_NAME | VARCHAR2(4000) | YES | The name of the column in the constraint. |
| POSITION | NUMBER | YES | The position of the column in the constraint. |
Sample query
Query the column information of constraints on the TBL3 table among the tables owned by the user.
obclient [SYS]> SELECT * FROM SYS.USER_CONS_COLUMNS WHERE TABLE_NAME='TBL3';
The query result is as follows:
+-------+----------------------------+------------+-------------+----------+
| OWNER | CONSTRAINT_NAME | TABLE_NAME | COLUMN_NAME | POSITION |
+-------+----------------------------+------------+-------------+----------+
| SYS | TBL3_OBPK_1744012420113641 | TBL3 | COL1 | 1 |
+-------+----------------------------+------------+-------------+----------+
1 row in set
References
ALL_CONS_COLUMNS: View the constraint information on all tables that the current user can access.
DBA_CONS_COLUMNS: View the constraint information on all tables in the current tenant.
For more information about constraints, see Define the constraint type for a column.