Monday, October 23, 2017

Query to find Constraints on Tables

SELECT UCC.OWNER,
       UCC.TABLE_NAME,
       UCC.COLUMN_NAME,
       DECODE (UC.CONSTRAINT_TYPE,
               'P', 'Primary Key',
               'R', 'Reference Key',
               'C', 'Check')
          "TYP E",
       UC.SEARCH_CONDITION "COND",
       UCC1.TABLE_NAME "REF_TABLE",
       UCC1.COLUMN_NAME "REF_COLUMN",
       UC.STATUS
  FROM USER_CONS_COLUMNS UCC, USER_CONSTRAINTS UC, USER_CONS_COLUMNS UCC1
 WHERE     UCC.TABLE_NAME = '&TABLE_NAME'
       AND UC.CONSTRAINT_NAME(+) = UCC.CONSTRAINT_NAME
       AND UCC1.CONSTRAINT_NAME(+) = UC.R_CONSTRAINT_NAME
      
SELECT * FROM USER_CONS_COLUMNS  

No comments:

Post a Comment

currentAppUi built in variable in VBCS

$global.currentAppUi.id :- The id of the App UI $global.currentAppUi.urlId :-The id of the App UI as shown in the URL $global.currentAppUi.d...