provide table name get constraint name column name position

set line 100
col CONSTRAINT_NAME for a20
col REFERENCES_TABLE for a20
col COLUMN_NAME for a20
col SEARCH_CONDITION for a20

select UCC.CONSTRAINT_NAME, UCC.COLUMN_NAME, UCC.POSITION ,UC.CONSTRAINT_TYPE, UC.SEARCH_CONDITION, UC2.TABLE_NAME as REFERENCES_TABLE
from USER_CONS_COLUMNS UCC, USER_CONSTRAINTS UC, USER_CONSTRAINTS UC2
where UCC.CONSTRAINT_NAME = UC.CONSTRAINT_NAME
and UC.R_CONSTRAINT_NAME = UC2.CONSTRAINT_NAME(+)
and UCC.TABLE_NAME = ‘TC_DTL’
order by UCC.CONSTRAINT_NAME, UCC.POSITION
/

Advertisements