• disable enable 所有其他表关联的外键


    Disable:

    begin

    for i in (select constraint_name, table_name from user_constraints where constraint_name in (select fk_col.constraint_name

      from user_constraints pk, user_constraints fk, user_cons_columns fk_col

     where pk.table_name = '表名'

       and pk.constraint_type = 'P'

       and fk.r_constraint_name = pk.constraint_name

       and fk_col.constraint_name = fk.constraint_name)) LOOP

    execute immediate 'alter table '||i.table_name||' disable constraint '||i.constraint_name||'';

    end loop;

    end;

    enable:

    begin

    for i in (select constraint_name, table_name from user_constraints where constraint_name in (select fk_col.constraint_name

      from user_constraints pk, user_constraints fk, user_cons_columns fk_col

     where pk.table_name = '表名'

       and pk.constraint_type = 'P'

       and fk.r_constraint_name = pk.constraint_name

       and fk_col.constraint_name = fk.constraint_name)) LOOP

    execute immediate 'alter table '||i.table_name||' enable constraint '||i.constraint_name||'';

    end loop;

    end;

    /

    COMMIT;

  • 相关阅读:
    网络编程[28]
    网络编程[30]
    网络编程[20]
    网络编程[29]
    网络编程[19]
    网络编程[15]
    网络编程[12]
    hdu 3802【Ipad,IPhone】
    hdu 2616【Kill the monster】
    hdu 1026【Ignatius and the Princess I】
  • 原文地址:https://www.cnblogs.com/kakaisgood/p/9068813.html
Copyright © 2020-2023  润新知