zoukankan      html  css  js  c++  java
  • Oracle 在Drop表时的Cascade Constraints

    http://hi.baidu.com/rebooo/item/12b500b130022bf263388e69假设A为主表(既含有某一主键的表),B为从表(即引用了A的主键作为外键)。则当删除A表时,如不特殊说明,则 drop table A 系统会出现如下错误警告的信息而不会允许执行。

    ERROR at line 1:  ORA-02449: unique/primary keys in table referenced by foreign keys 

    此时必须用,drop table A cascade constraints

    之后,再查询约束:

    SQL> select CONSTRAINT_NAME,TABLE_NAME from dba_constraints where owner = 'SYS' and TABLE_NAME = 'B' ;
    no rows selected


    利用Drop table cascade constraints可以删除从表的constraint,从而可实现drop table A。原属于B的foreign key constraint已经跟随着被删除掉了,但是,储存在table B中的记录不会被删除,也就是说Drop table cascade constraints 时不会影响到存储于objec里的row data。
     
  • 相关阅读:
    Python生成器表达式
    Python列表解析
    Python迭代器(Iterator)
    Python set 集合
    python eval 函数妙用
    Python字典 (dict)
    Python序列之元组 (tuple)
    Python序列之列表 (list)
    递归和反射
    常用标准库
  • 原文地址:https://www.cnblogs.com/svennee/p/4083328.html
Copyright © 2011-2022 走看看