Tuesday, October 27, 2009

5.3 Constraint Views



[ Team LiB ]





5.3 Constraint Views


There are two data dictionary views that provide you detailed information about constraints. These are USER_CONSTRAINTS and USER_CONS_COLUMNS.


A table can have no constraints, or many. For every constraint in a table there is a row in USER_CONSTRAINTS that describes that particular constraint, including the table name to which that constraint is applied. If you know a constraint name and you want to know the constraint type, query USER_CONSTRAINTS. This view describes the constraint definition. It does not provide you with the column name(s) on which that constraint is defined.


The USER_CONS_COLUMNS view shows the columns in a constraint. If a primary key is a concatenated key, there will be two rows for that constraint in this view. Each column in the concatenated primary key constraint will have a row, and each row will differ by POSITION�this indicates the position of a column with respect to concatenated column constraints.


The following table highlights the joining columns of these views. USER_CONSTRAINTS and USER_CONS_COLUMNS each have the column CONSTRAINT_NAME and TABLE_NAME.


USER_CONSTRAINTS

USER_CONST_COLUMNS

CONSTRAINT_NAME

CONSTRAINT_NAME

CONSTRAINT_TYPE

TABLE_NAME

TABLE_NAME

COLUMN_NAME

 

POSITION





    [ Team LiB ]



    No comments: