Last active
March 25, 2016 22:07
-
-
Save ryanpadilha/ede0bb6d24517dbb2930 to your computer and use it in GitHub Desktop.
Oracle constraint verification
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
-- SQL command | |
SELECT CPAI.OWNER, CPAI.CONSTRAINT_NAME, CPAI.CONSTRAINT_TYPE, CPAI.TABLE_NAME, | |
CPAI.STATUS, CPAI.R_CONSTRAINT_NAME, COL.COLUMN_NAME, | |
( | |
SELECT F.TABLE_NAME FROM DBA_CONSTRAINTS F | |
WHERE F.CONSTRAINT_NAME = CPAI.R_CONSTRAINT_NAME | |
) TABLE_NAME_FILHA | |
FROM DBA_CONSTRAINTS CPAI, DBA_CONS_COLUMNS COL | |
WHERE CPAI.CONSTRAINT_NAME = COL.CONSTRAINT_NAME | |
AND CPAI.OWNER = '&PROPRIETARIO' | |
AND CPAI.TABLE_NAME = '&TABELA' | |
AND CPAI.CONSTRAINT_TYPE = 'R' | |
GROUP BY CPAI.OWNER, CPAI.CONSTRAINT_NAME, CPAI.CONSTRAINT_TYPE, | |
CPAI.TABLE_NAME, CPAI.STATUS, CPAI.R_CONSTRAINT_NAME, COL.COLUMN_NAME | |
ORDER BY COL.COLUMN_NAME; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment