PRIMARY KEY constraint
SELECT
User_cons_columns. Constraint_name as constraint name,
User_cons_columns. table_name as table name,
User_cons_columns. column_name as column name,
User_cons_columns. POSITION as Location
From
User_constraints
JOIN User_cons_columns
On (user_constraints. Constraint_name
= User_cons_columns. constraint_name)
WHERE
Constraint_type = ' P ';
FOREIGN KEY constraints
SELECT
User_cons_columns. Constraint_name as constraint name,
User_cons_columns. TABLE_NAME as sub-table name,
User_cons_columns. column_name as child table column name,
User_cons_columns. POSITION as location,
User_indexes. table_name as Main Table name,
User_ind_columns. column_name as Main Table column name
From
User_constraints
JOIN User_cons_columns
On (user_constraints. Constraint_name
= User_cons_columns. constraint_name)
JOIN user_indexes
On (user_constraints. R_constraint_name
= User_indexes. index_name)
JOIN User_ind_columns
On (user_indexes. Index_name = User_ind_columns. index_name)
WHERE
Constraint_type = ' R ';
Other constraints
SELECT
User_cons_columns. Constraint_name as constraint name,
User_cons_columns. table_name as table name,
User_cons_columns. column_name as column name,
User_cons_columns. POSITION as location,
Constraint_type,
Search_condition
From
User_constraints
JOIN User_cons_columns
On (user_constraints. Constraint_name
= User_cons_columns. constraint_name)
WHERE
Constraint_type in (' C ', ' V ', ' O ');
Oracle Queries all constraints