介绍
DBA_CONSTRAINTS视图提供了查询当前数据库中所有定义(创建)的约束信息,通过该视图能够让我们查询到诸如主键、外键、唯一键等的基础信息。
视图详情
字段名 | 字段类型 | 描述 | 译 | 备注 |
OWNER | VARCHAR2(30) | Owner of the constraint definition | 定义约束的用户 | |
CONSTRAINT_NAME | VARCHAR2(30) | Name of the constraint definition | 约束的名称 | |
CONSTRAINT_TYPE | VARCHAR2(1) | Type of the constraint definition: C - Check constraint on a table P - Primary key U - Unique key R - Referential integrity V - With check option, on a view O - With read only, on a view H - Hash expression F - Constraint that involves a REF column S - Supplemental logging | 约束定义的类型: C - 检查约束 P - 主键 U - 唯一键 R - 引用完整性 V - 视图检查约束 O - 视图只读约束 H - Hash表达式 F - S - | |
TABLE_NAME | VARCHAR2(30) | Name associated with the table (or view) with the constraint definition | 约束定义的表名(或视图名) | |
SEARCH_CONDITION | LONG | Text of search condition for a check constraint | 检查约束的搜索条件文本内容 | |
R_OWNER | VARCHAR2(30) | Owner of the table referred to in a referential constraint | 引用约束中的表的拥有者 | |
R_CONSTRAINT_NAME | VARCHAR2(30) | Name of the unique constraint definition for the referenced table | 引用表中的唯一约束名称 | |
DELETE_RULE | VARCHAR2(9) | Delete rule for a referential constraint: CASCADE SET NULL NO ACTION | 删除引用约束的规则: 级联 设置空值 无操作 | |
STATUS | VARCHAR2(8) | Enforcement status of the constraint: ENABLED DISABLED | 约束的状态: 启用 禁用 | |
DEFERRABLE | VARCHAR2(14) | Indicates whether the constraint is deferrable (DEFERRABLE) or not (NOT DEFERRABLE) | 约束是否可延迟,DEFERRABLE-可延迟,NOT DEFERRABLE-不可延迟 | |
DEFERRED | VARCHAR2(9) | Indicates whether the constraint was initially deferred (DEFERRED) or not (IMMEDIATE) | 约束创建时是否延迟,DEFERRED-延迟,IMMEDIATE-不延迟 | |
VALIDATED | VARCHAR2(13) | When STATUS = ENABLED, possible values are: VALIDATED - All data obeys the constraint (that is, the existing data in the table was validated when the constraint was enabled, as well as any subsequent data entered into the table) NOT VALIDATED - All data may not obey the constraint (that is, the existing data in the table was not validated when the constraint was enabled, but subsequent data entered into the table was validated) When STATUS = DISABLED, possible values are: VALIDATED - All data obeys the constraint, but the unique index on the constraint has been dropped. This setting is useful in data warehousing environments, but has some restrictions. NOT VALIDATED - All data may not obey the constraint | 当约束的状态是启用时,该值可能是: VALIDATED - 所有数据遵循约束(表中现有的数据被验证,以及验证之后插入的数据) NOT VALIDATED - 所有数据可能无法遵循约束(启用约束时未验证表中现有的数据,但之后插入的数据进行验证) 当约束的状态是禁用时,该值可能是: VALIDATED - 所有数据遵循约束,但约束的唯一索引被删除。(此项在数据仓库中很有用,但会有一些限制) NOT VALIDATED - 所有数据不遵循约束 | |
GENERATED | VARCHAR2(14) | Indicates whether the name of the constraint is user-generated (USER NAME) or system-generated (GENERATED NAME) | 约束名称是否由用户创建,USER NAME-用户创建,GENERATED NAME-Oracle生成的 | |
BAD | VARCHAR2(3) | Indicates whether this constraint specifies a century in an ambiguous manner (BAD) or not (NULL). To avoid errors resulting from this ambiguity, rewrite the constraint using the TO_DATE function with a four-digit year. | 约束是否以不明确的方式指定一个世纪。BAD-不明确的方式 | 为了避免这种歧义导致的错误,可以使用to_date重写约束,并使用四位数字的年份 |
RELY | VARCHAR2(4) | When VALIDATED = NOT VALIDATED, this column indicates whether the constraint is to be taken into account for query rewrite (RELY) or not (NULL). When VALIDATED = VALIDATED, this column is not meaningful. | 是否考虑查询重写的约束,NOT VALIDATED-考虑查询重写的约束,VALIDATED-值没有意义 | |
LAST_CHANGE | DATE | When the constraint was last enabled or disabled | 约束最后一次启用或禁用的时间 | |
INDEX_OWNER | VARCHAR2(30) | Name of the user owning the index | 索引的拥有者(用户名) | |
INDEX_NAME | VARCHAR2(30) | Name of the index (only shown for unique and primary-key constraints) | 索引名称 | 此列仅显示唯一索引和主键索引 |
INVALID | VARCHAR2(7) | Indicates whether the constraint is invalid (INVALID) or not (NULL) | 索引是否无效,INVALID-无效,NULL-空 | |
VIEW_RELATED | VARCHAR2(14) | Indicates whether the constraint depends on a view (DEPEND ON VIEW) or not (NULL) | 约束是否取决于视图,DEPEND ON VIEW-取决于视图,NULL-空 |
评论区