Programming Oracle Triggers and Stored Procedures (3rd Edition) (Prentice Hall PTR Oracle Series)

The USER_CONS_COLUMNS tells you what columns make up the constraint. Details about the constraint, such as whether it is a CHECK or UNIQUE constraint, are in USER_CONSTRAINTS. The SQL*Plus describe of the table is the following.

SQL> DESC user_cons_columns Name Null? Type ----------------------------- -------- ----------------- OWNER NOT NULL VARCHAR2(30) CONSTRAINT_NAME NOT NULL VARCHAR2(30) TABLE_NAME NOT NULL VARCHAR2(30) COLUMN_NAME VARCHAR2(4000) POSITION NUMBER

OWNER

This is the owner of the table in which the constraint is enforced.

CONSTRAINT_NAME

This is the name used in the DDL. You use this name to ALTER or DROP the constraint. If there is no constraint name specified in the DDL, Oracle creates the constraint with a format similar to SYS_C followed by a unique sequence of digits.

TABLE_NAME

The name of the table that has the constraint.

COLUMN_NAME

This is the column name of the constraint.

POSITION

This applies to the concatenated primary key, unique, and foreign keys. Our STUDENT DDL creates a concatenated unique constraint on columns for a student's STATE and LICENSE. For this constraint, there are two columns and two rows in this view. The row in this view, for this constraint, will have POSITION=1 for STATE and POSITION=2 for LICENSE.

Категории