Oracle 视图 ALL_CONS_COLUMNS 官方解释,作用,如何使用详细说明

本站中文解释

ALL_CONS_COLUMNS视图提供了表约束/索引的信息,该视图仅描述当前用户有权限的表的约束/索引的列组成。

该视图的字段包括: owner: 表的拥有者;table_name: 表的名称;constraint_name: 约束名;column_name: 列的名称;position: 列的顺序号;status: 状态;delete_rule: 当更新或删除表中约束列上的值时,执行的操作。

使用方法:

要查询某表的约束/索引,可以使用以下语句:

SELECT * FROM all_cons_columns
WHERE owner = ‘user_name’
AND table_name = ‘table_name’
AND constraint_name = ‘constraint_name’;

其中,user_name替换为指定表的拥有者,table_name替换为需查询表名,constraint_name替换为查询索引/约束的名称。

官方英文解释

ALL_CONS_COLUMNS describes columns that are accessible to the current user and that are specified in constraints.

Related Views

  • DBA_CONS_COLUMNS describes all columns in the database that are specified in constraints.

  • USER_CONS_COLUMNS describes columns that are owned by the current user and that are specified in constraints.

Column Datatype NULL Description

OWNER

VARCHAR2(128)

NOT NULL

Owner of the constraint definition

CONSTRAINT_NAME

VARCHAR2(128)

NOT NULL

Name of the constraint definition

TABLE_NAME

VARCHAR2(128)

NOT NULL

Name of the table with the constraint definition

COLUMN_NAME

VARCHAR2(4000)

Name of the column or attribute of the object type column specified in the constraint definition

Note: If you create a constraint on a user-defined REF column, the system creates the constraint on the attributes that make up the REF column. Therefore, the column names displayed in this view are the attribute names, with the REF column name as a prefix, in the following form:

"REF_name"."attribute"

POSITION

NUMBER

Original position of the column or attribute in the definition of the object

See Also:

  • “DBA_CONS_COLUMNS”

  • “USER_CONS_COLUMNS”


数据运维技术 » Oracle 视图 ALL_CONS_COLUMNS 官方解释,作用,如何使用详细说明