This type of thing is possible in PL/SQL:
However DBMS_METADATA might be a better approach.Code:BEGIN FOR r IN ( SELECT cns.table_name, cns.constraint_name , cns.search_condition FROM user_constraints cns , user_cons_columns col WHERE cns.constraint_type = 'C' AND col.owner = cns.owner AND col.table_name = cns.table_name AND col.constraint_name = cns.constraint_name ) LOOP DBMS_OUTPUT.PUT_LINE ( 'ALTER TABLE ' || r.table_name || ' ADD CONSTRAINT ' || r.constraint_name || ' CHECK (' || r.search_condition || ');'); END LOOP; END;




Reply With Quote