Created
January 5, 2018 17:33
-
-
Save marcosvidolin/d7c5cefd0e2fb61a78ba381523d6d59b to your computer and use it in GitHub Desktop.
How to see all references for a FK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT a.table_name, a.column_name, a.constraint_name, c.owner, | |
c.r_owner, c_pk.table_name r_table_name, c_pk.constraint_name r_pk | |
FROM all_cons_columns a | |
JOIN all_constraints c ON a.owner = c.owner AND a.constraint_name = c.constraint_name | |
JOIN all_constraints c_pk ON c.r_owner = c_pk.owner AND c.r_constraint_name = c_pk.constraint_name | |
WHERE c.constraint_type = 'R' AND A.COLUMN_NAME = '<COLUMN_NAME>' and c.owner = '<OWNER_NAME>' | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment