Sunday, 23 April 2017

Automated Script to Enable/Disable Foreign Key Constrain in Oracle Database

select 'ALTER TABLE HR.' || cons.TABLE_NAME || ' enable constraint ' || cons.constraint_name || ';' as, cons.owner as child_owner, cons.table_name as child_table, cons.constraint_name constaint_name, cons.constraint_type constraint_type, col.owner parent_owner, col.table_name parent_table, col.column_name column_name from dba_cons_columns col, dba_constraints cons where cons.r_owner = col.owner and cons.r_constraint_name = col.constraint_name and col.owner = 'HR

No comments:

Post a Comment