建立主外键的constraint

create table emp1(emp_no number(2) constraint emp_emp_no_pk primary key,
ename varchar2(15),
salary number(8,2),
mgr_no number(2) constraint emp_mgr_fk references emp1);

查询状态

SQL> select constraint_name,constraint_type ,status from user_constraints where table_name='EMP1'
2 ;

CONSTRAINT_NAME C STATUS
------------------------------ - --------
EMP_EMP_NO_PK P ENABLED
EMP_MGR_FK R ENABLED

alter table emp1 disable constraint emp_emp_no_pk cascade;

SQL> select constraint_name,constraint_type ,status from user_constraints where table_name='EMP1';

CONSTRAINT_NAME C STATUS
------------------------------ - --------
EMP_EMP_NO_PK P DISABLED
EMP_MGR_FK R DISABLED

alter table emp1 enable constraint emp_emp_no_pk ;

SQL> select constraint_name,constraint_type ,status from user_constraints where table_name='EMP1';

CONSTRAINT_NAME C STATUS
------------------------------ - --------
EMP_EMP_NO_PK P ENABLED
EMP_MGR_FK R DISABLED

仍然需要手工enable外键constraint

alter table emp1 enable constraint emp_mgr_fk;

SQL> select constraint_name,constraint_type ,status from user_constraints where table_name='EMP1'
2 ;

CONSTRAINT_NAME C STATUS
------------------------------ - --------
EMP_EMP_NO_PK P ENABLED
EMP_MGR_FK R ENABLED

关于constraint 的disable和enable的更多相关文章

  1. Android启动另一个APP时,注意disable与enable的问题

    在写游戏sdk时候遇到了一个需要在sdk中通过scheme来启动支付宝的免密支付功能,所以需要在设备中通过包名检查一下支付宝是否存在. 此时遇到了一个问题,在三星设备中可以将app给处于disable ...

  2. html元素禁用disable or enable

    场景说明 ajax提交数据,防止收到服务端相应前用户重复点击. 1.用户点击按钮,禁用当前按钮,发起ajax请求. 2.收到ajax请求,还原当前按钮. html解决方案 参考地址:http://ww ...

  3. button disable and enable

    1. disable <button id="buttonId" disabled>......</button> $("#buttonId&qu ...

  4. Disable or enable the IPv6 protocol in Red Hat Enterprise Linux

    Resolution Red Hat Enterprise Linux 4, 5 and 6 enable Internet Protocol Version 6 (IPv6) by default. ...

  5. 翻译:MariaDB ALTER TABLE语句

    */ .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; } .hl ...

  6. How to Disable/Enable IP forwarding in Linux

    This article describes how to Disable or Enable an IP forwarding in Linux. Current IP forwarding sta ...

  7. knockout.js绑定(enable,disable,visable)

    <input type="text" data-bind="disable:IsNew" /> enable :是否可用,为true时,可编辑 di ...

  8. Oracle约束(Constraint)详解

    概述 约束是数据库用来确保数据满足业务规则的手段,不过在真正的企业开发中,除了主键约束这类具有强需求的约束,像外键约束,检查约束更多时候仅仅出现在数据库设计阶段,真实环境却很少应用,更多是放到程序逻辑 ...

  9. ORACLE中CONSTRAINT的四对属性

    ORACLE中CONSTRAINT的四对属性 summary:在data migrate时,某些表的约束总是困扰着我们,让我们的migratet举步维艰,怎样利用约束本身的属性来处理这些问题呢?本文具 ...

随机推荐

  1. Python小程序之用户登陆接口

    编写登陆接口 输入用户名密码 认证成功后显示欢迎信息 输错三次后锁定 程序逻辑图: 代码: #!/usr/bin/env python #_*_ coding:UTF-8 _*_ #__author_ ...

  2. linux驱动学习(八) i2c驱动架构(史上最全) davinc dm368 i2c驱动分析【转】

    转自:http://blog.csdn.net/ghostyu/article/details/8094049 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] 预备知识 lin ...

  3. 搭建git for windows服务器(100%可以成功)【转】

    转自:http://blog.csdn.net/code_style/article/details/38764203 既然Git在linux下面非常好用,为什么还要搭建git windows的服务器 ...

  4. 使用go写一个检测tcpudp状态的包

    使用go写一个检测tcpudp状态的包 http://www.2cto.com/os/201501/367596.html

  5. 利用php设置url转发 - 解决空间不提供子目录绑定功能的问题

    由于很多新手都是使用的虚拟空间都是最便宜的那种,这空间一般不支持子目录绑定.但是很多朋友又想设置几个不同的二级域名访问不同的网站程序.于是大家找到了域名url转发,但是由于国家政策的原因,许多服务商暂 ...

  6. 电脑IP总是变的问题

    如题,如何解决该问题? 右键---->个性化---->更改桌面图标---->添加网络图标 右键网络图标----->属性---->更改适配器设置---->右键属性,找 ...

  7. Selenium 多窗口元素定位处理

    以下文章来自于  上海-悠悠的博客 <Selenium2+python自动化13-多窗口.句柄(handle)> 有些页面的链接打开后,会重新打开一个窗口,对于这种情况,想在新页面上操作, ...

  8. Redis Hlen 命令用于获取哈希表中字段的数量

    http://www.runoob.com/redis/hashes-hlen.html

  9. python encode和decode函数说明

    字符串编码常用类型:utf-8,gb2312,cp936,gbk等. Python中,我们使用decode()和encode()来进行解码和编码 在python中,使用unicode类型作为编码的基础 ...

  10. Python 进阶 之 lambda 匿名函数

    lambda 是个匿名函数,通常用于简单判断或者处理,例如判断一个数的奇偶性,过滤字符串,逻辑运算等等. lambda表达式: >>>lambda x:x*x >>> ...