Skip to content

Instantly share code, notes, and snippets.

@zigarn
Created June 19, 2013 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zigarn/5813261 to your computer and use it in GitHub Desktop.
Save zigarn/5813261 to your computer and use it in GitHub Desktop.
select
src_cc.owner as src_owner, src_cc.table_name as src_table, src_cc.column_name as src_column,
dest_cc.owner as dest_owner, dest_cc.table_name as dest_table, dest_cc.column_name as dest_column,
c.constraint_name
from
all_constraints c
inner join all_cons_columns dest_cc on c.r_constraint_name = dest_cc.constraint_name and c.r_owner = dest_cc.owner
inner join all_cons_columns src_cc on c.constraint_name = src_cc.constraint_name and c.owner = src_cc.owner
where
c.constraint_type = 'R'
and dest_cc.owner = 'MY_TARGET_SCHEMA'
and dest_cc.table_name = 'MY_TARGET_TABLE'
-- and dest_cc.column_name = 'MY_TARGET_COLUMN'
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment