sys ed eseguite questa query:
select a.tt, a.owner, b.table_name, a.constraint_name, b.column_name, b.position, a.r_constraint_name, c.column_name, c.position, c.table_name r_table_name, a.r_owner from (select owner, constraint_name, r_constraint_name, r_owner,1 tt from dba_constraints where owner=upper(‘mioUtente‘) and table_name=upper(‘miaTabella‘) and constraint_type!=’C’ union select owner, constraint_name, r_constraint_name, r_owner,2 from dba_constraints where (r_constraint_name,r_owner) in (select constraint_name, owner from dba_constraints where owner=upper(‘mioUtente‘) and table_name=upper(‘miaTabella‘)) ) a, dba_cons_columns b, dba_cons_columns c where b.constraint_name=a.constraint_name and b.owner=a.owner and c.constraint_name=a.r_constraint_name and c.owner=a.r_owner and b.position=c.position order by 1,2,3,4,5
Dopo questo lunghissimo script SQL otterremo una tabella conn descritti i constraint che legano la tabella “miaTabella” (segnata in grassetto nello script) con le altre tabella, viene visualizzato anche qual’è il campo che fa da merge. Dovreste sostituire mioUtente e miaTabelle con i veri nomi dell’utente e della tabella che volete analizzare.
]]>