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

SupplierAddressImportTemplate.xlsm South Africa Suburb Field mapping in POZ_SUPPLIER_ADDRESSES_INT

Suburb mpping in Supplier Address Import Template will be mapped to Address Element Attribute2 (HZ_LOCATIONS. ADDR_ELEMENT_ATTRIBUTE2)