Primary key and Foreign key
SQL Statement as follows:
select c.CONSTRAINT_name,
c.Table_NAME,
l.COLUMN_NAME,
l.position,
‘FK’ as type
from sys.ALL_CONSTRAINTS c, sys.ALL_CONS_COLUMNS l
where c.CONSTRAINT_name = l.CONSTRAINT_name
and c.CONSTRAINT_TYPE = ‘R’
and c.owner = ‘SNRC’
and c.Table_NAME not like ‘BIN%’
union
select c.CONSTRAINT_name,
c.Table_NAME,
l.COLUMN_NAME,
l.position,
‘PK’ as type
from sys.ALL_CONSTRAINTS c, sys.ALL_CONS_COLUMNS l
where c.CONSTRAINT_name = l.CONSTRAINT_name
and c.CONSTRAINT_TYPE = ‘P’
and c.owner = ‘SNRC’
and c.Table_NAME not like ‘BIN%’;