Purpose
This view displays the constraints of all tables accessible to the current user.
Applicability
This view is available only in Oracle mode of OceanBase Database.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| OWNER | VARCHAR2(128) | NO | The owner of the constraint. |
| CONSTRAINT_NAME | VARCHAR2(128) | NO | The name of the constraint. |
| CONSTRAINT_TYPE | VARCHAR2(1) | NO | The type of the index. Only the NORMAL type is supported. |
| TABLE_NAME | VARCHAR2(128) | NO | The name of the table to which the constraint applies. |
| SEARCH_CONDITION | VARCHAR2(4000) | NO | The text of the search condition for the check constraint. |
| R_OWNER | VARCHAR2(128) | NO | The owner of the referenced constraint. |
| R_CONSTRAINT_NAME | VARCHAR2(128) | NO | The name of the referenced constraint. |
| DELETE_RULE | VARCHAR2(9) | NO | The cascade delete rule for the foreign key constraint. |
| STATUS | VARCHAR2(8) | NO | Indicates whether the constraint is ENABLE or DISABLE. |
| DEFERRABLE | VARCHAR2(14) | NO | Indicates whether the constraint is DEFERRABLE or NOT DEFERRABLE. |
| DEFERRED | VARCHAR2(9) | NO | Indicates whether the constraint is DEFERRED or IMMEDIATE. |
| VALIDATED | VARCHAR2(13) | NO | Indicates whether the constraint is VALIDATED or NOT VALIDATED |
| GENERATED | VARCHAR2(14) | NO | Indicates whether the constraint name is a user-defined name or a generated name. |
| BAD | VARCHAR2(3) | NO | This column is not supported. It is NULL by default. |
| RELY | VARCHAR2(4) | NO | Indicates whether the constraint is in RELY mode. |
| LAST_CHANGE | DATE | NO | The last time the constraint was changed to ENABLE or DISABLE. |
| INDEX_OWNER | VARCHAR2(128) | NO | The owner of the index for the constraint. |
| INDEX_NAME | VARCHAR2(128) | NO | The name of the index for the constraint. |
| INVALID | VARCHAR2(7) | NO | Indicates whether the constraint is INVALID. |
| VIEW_RELATED | VARCHAR2(14) | NO | Indicates whether the constraint is defined on a view. |
Sample query
Query the constraints of all tables accessible to the current user.
obclient [SYS]> SELECT * FROM SYS.ALL_CONSTRAINTS\G
The query result is as follows:
*************************** 1. row ***************************
OWNER: oceanbase
CONSTRAINT_NAME: idx_task_key
CONSTRAINT_TYPE: U
TABLE_NAME: __all_ddl_task_status
SEARCH_CONDITION: NULL
R_OWNER: NULL
R_CONSTRAINT_NAME: NULL
DELETE_RULE: NULL
STATUS: ENABLED
DEFERRABLE: NOT DEFERRABLE
DEFERRED: IMMEDIATE
VALIDATED: VALIDATED
GENERATED: NULL
BAD: NULL
RELY: NULL
LAST_CHANGE: NULL
INDEX_OWNER: oceanbase
INDEX_NAME: idx_task_key
INVALID: NULL
VIEW_RELATED: NULL
*************************** 2. row ***************************
OWNER: oceanbase
CONSTRAINT_NAME: idx_transfer_partition_key
CONSTRAINT_TYPE: U
TABLE_NAME: __all_transfer_partition_task
SEARCH_CONDITION: NULL
R_OWNER: NULL
R_CONSTRAINT_NAME: NULL
DELETE_RULE: NULL
STATUS: ENABLED
DEFERRABLE: NOT DEFERRABLE
DEFERRED: IMMEDIATE
VALIDATED: VALIDATED
GENERATED: NULL
BAD: NULL
RELY: NULL
LAST_CHANGE: NULL
INDEX_OWNER: oceanbase
INDEX_NAME: idx_transfer_partition_key
INVALID: NULL
VIEW_RELATED: NULL
2 rows in set
References
Query the constraints of all tables owned by the current user: USER_CONSTRAINTS
Query the constraints of all tables in the current tenant: DBA_CONSTRAINTS
For more information about column constraint types, see the following topics: