zoukankan      html  css  js  c++  java
  • 怎样查外键建在哪个表上

    有时候删除某张表记录的时候,会报错外键约束不能删除。

    如果不了解表之间的关系,可以通过以下语句查询到外键是建在哪张表上的:

    select * from dba_constraints where constraint_name='xxx' and constraint_type = 'R';

    例如:

    执行delete from t_bme_task;时报错:

    ORA-02292: integrity constraint (CCSYS.FK_T_BME_TASKRUNRESULT_TASKID) violated - child record found

    可以通过执行

    select table_name from dba_constraints where constraint_name='FK_T_BME_TASKRUNRESULT_TASKID' and  constraint_type = 'R';

    查询出外键是建在T_BME_TASKRUNRESULT表上的,先把T_BME_TASKRUNRESULT表删除,就可以删除 t_bme_task表记录了。

  • 相关阅读:
    mySQL安装的时候一直卡在starting server这里解决办法
    编译安装nginx
    用户访问网站原理及流程
    mysql备份及恢复
    sed
    mysql 基础
    nginx优化
    mysql 三种日志
    tr
    date
  • 原文地址:https://www.cnblogs.com/aoyihuashao/p/2715288.html
Copyright © 2011-2022 走看看