Oracle 视图 ALL_CONSTRAINTS 官方解释,作用,如何使用详细说明
本站中文解释
视图给出了一个用户或其他用户的模式中的表或视图的所有约束信息,例如主键、唯一性约束、外键以及其他类型约束等。
通过使用 ALL_CONSTRAINTS 视图,我们可以查找下面的信息:
(1)被约束的表名或视图名
(2)约束类型,即 PRIMARY KEY、UNIQUE、FOREIGN KEY、CHECK 等。
(3)搜索条件,例如查找某张表的主键约束,我们可以使用以下语句进行查找:SELECT * FROM ALL_CONSTRAINTS WHERE TABLE_NAME=’TABLE_NAME’ AND CONSTRAINT_TYPE=’P’;
(4)约束名称
(5)引用列名称
(6)引用id,用于约束类型为外键和父检查类型时表示相应表或检查表的object_id
官方英文解释
ALL_CONSTRAINTS
describes constraint definitions on tables accessible to the current user.
Related Views
-
DBA_CONSTRAINTS
describes all constraint definitions in the database. -
USER_CONSTRAINTS
describes constraint definitions on tables in the current user’s schema.
Column | Datatype | NULL | Description |
---|---|---|---|
|
|
Owner of the constraint definition |
|
|
|
Name of the constraint definition |
|
|
|
Type of the constraint definition:
|
|
|
|
Name associated with the table (or view) with the constraint definition |
|
|
|
Text of search condition for a check constraint. This column returns the correct value only when the row originates from the current container. |
|
|
|
Text of search condition for a check constraint. This column may truncate the search condition. |
|
|
|
Owner of the table referred to in a referential constraint |
|
|
|
Name of the unique constraint definition for the referenced table |
|
|
|
Delete rule for a referential constraint:
|
|
|
|
Enforcement status of the constraint:
|
|
|
|
Indicates whether the constraint is deferrable ( |
|
|
|
Indicates whether the constraint was initially deferred ( |
|
|
|
When
When
|
|
|
|
Indicates whether the name of the constraint is user-generated ( |
|
|
|
Indicates whether this constraint specifies a century in an ambiguous manner ( See Also: the |
|
|
|
When When See Also: constraints in Oracle Database SQL |
|
|
|
When the constraint was last enabled or disabled |
|
|
|
Name of the user owning the index |
|
|
|
Name of the index (only shown for unique and primary-key constraints) |
|
|
|
Indicates whether the constraint is invalid ( |
|
|
|
Indicates whether the constraint depends on a view ( |
|
|
|
The ID of the container where the data originates. Possible values include:
|
See Also:
-
“DBA_CONSTRAINTS”
-
“USER_CONSTRAINTS”