select 'alter table '||a.owner||'.'||a.table_name||' enable constraint '||a.constraint_name||';' from all_constraints a, all_constraints b where a.constraint_type = 'R' and a.r_constraint_name = b.constraint_name and a.r_owner = b.owner and b.table_name in ( '&TABLE1','&TABLE2'); / Here’s a query you can use to find bad records based on a constraint name (replace the part in red): select 'select * from ' || dc.table_name || ' where not exists (select 1 from ' || dcc1.table_name || ' where ' || dcc1.table_name || '.' || dcc1.column_name || ' = ' || dcc2.table_name || '.' || dcc2.column_name || ');' from dba_constraints dc inner join dba_cons_columns dcc1 on dc.r_constraint_name = dcc1.constraint_name inner join dba_cons_columns dcc2 on dc.constraint_name = dcc2.constraint_name where dc.constraint_name = 'EDBC_PERS_PERS_FK' and dc.owner = 'P3_CUR2_TRG' and dcc1.owner = 'P3_CUR2_TRG' and dcc2.owner = 'P3_CUR2_TRG';