BEGIN
    -- Enabled constraint
    FOR rec IN
      (SELECT c.owner, c.table_name, c.constraint_name
       FROM all_constraints c, all_tables t
       WHERE c.table_name = t.table_name
       AND c.owner = 'ALLIANCE'
       AND c.status = 'DISABLED'
       ORDER BY c.constraint_type)
    LOOP
        EXECUTE IMMEDIATE 'ALTER TABLE "' || rec.owner || '"."' || rec.table_name || '" ENABLE CONSTRAINT ' || rec.constraint_name;
    END LOOP;
END;

BEGIN
    -- Enabled trigger
    FOR rec IN
        (SELECT owner, table_name 
        FROM all_triggers
        WHERE owner = 'ALLIANCE')
    LOOP
        EXECUTE IMMEDIATE 'ALTER TABLE "' || rec.owner || '"."' || rec.table_name || '" ENABLE ALL TRIGGERS';
    END LOOP;
END;
