Search This Blog

Thursday, 5 March 2015

HOW TO CHECK FOREIGN KEYS IN EBS

SELECT tab.table_id, tab.table_name,  col.column_name,fk.foreign_key_name,
       pk_tab.table_name pk_table_name, pk_col.column_name pk_column_name,pk.PRIMARY_KEY_NAME
  FROM fnd_tables tab,
       fnd_columns col,
       fnd_foreign_keys fk,
       fnd_foreign_key_columns fkc,
       fnd_primary_keys pk,
       fnd_primary_key_columns pkc,
       fnd_tables pk_tab,
       fnd_columns pk_col
 WHERE tab.table_id = col.table_id
   AND fk.table_id = tab.table_id
   AND fkc.table_id = tab.table_id
   AND fkc.column_id = col.column_id
   AND fkc.foreign_key_id = fk.foreign_key_id
   AND fk.primary_key_application_id = pk.application_id
   AND fk.primary_key_id = pk.primary_key_id
   AND fk.primary_key_table_id = pk.table_id
   AND pk.primary_key_id = pkc.primary_key_id
   AND pk_tab.table_id = pkc.table_id
   AND pk_col.column_id = pkc.column_id
   AND pk_col.table_id = pkc.table_id
   AND pk_col.application_id = pkc.application_id
   AND pk.audit_key_flag = 'Y'

No comments:

Post a Comment