先找到該約束,然后再刪除。
具體表名可以這么找:select * from dict where instr(comment,'constrain')>0

解决方案 »

  1.   

    楼上的大哥,具体点 我的表名为 b 引用的表 为a
    要删除b的外键应用
    该如何写sql
      

  2.   

    SQL> desc dict
     名称                                      是否为空? 类型
     ----------------------------------------- -------- -----------
     TABLE_NAME                                         VARCHAR2(30
     COMMENTS                                           VARCHAR2(40SQL> select * from dict where instr(comments,'constr')>0;TABLE_NAME
    ------------------------------
    COMMENTS
    ---------------------------------------------------------------
    ALL_CONS_COLUMNS
    Information about accessible columns in constraint definitionsDBA_CONS_COLUMNS
    Information about accessible columns in constraint definitionsUSER_CONS_COLUMNS
    Information about accessible columns in constraint definitions
    先找到外鍵:
     SELECT a.r_constraint_name,b.column_name 
     from user_constraints a, user_cons_columns b
     where a.table_name = 'your_table' and a.constraint_type='R'
       and a.constraint_name=b.constraint_name
    然后:
    alter table ... drop constraint foreignKeyName