I m trying to find a query which will return me a list of the foreign keys for a table and the tables and columns they reference. I am half way there with
SELECT a.table_name,
a.column_name,
a.constraint_name,
c.owner
FROM ALL_CONS_COLUMNS A, ALL_CONSTRAINTS C
where A.CONSTRAINT_NAME = C.CONSTRAINT_NAME
and a.table_name=:TableName
and C.CONSTRAINT_TYPE = R
But I still need to know which table and primary key are referenced by this key. How would I get that?