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



Programming Oracle Triggers and Stored Procedures
Programming Oracle Triggers and Stored Procedures (3rd Edition) (Prentice Hall PTR Oracle Series)
ISBN: 0130850330
EAN: 2147483647
Year: 2003
Pages: 111
Authors: Kevin Owens

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net