Oracle里面constraint说明
首先来看一下《SQL Reference》中对于Constraint的说明:
unique (值必须唯一)
primary key (not null + unique)
goreign key (该表值必须在外键表中存在)
check (自己加的条件)
Table created.
Table created.
Table altered.
2 references cons_parent(id);
Table altered.
2 references cons_parent(id);
Table altered.
2 where constraint_name='CHI_FK_PAR';
---------------------------------------------
CHI_FK_PAR NOT DEFERRABLE
SET constraints chi_fk_par deferred
*
ERROR at line 1:
ORA-02447: cannot defer a constraint that is not deferrable
Table altered.
2 references cons_parent(id) deferrable;
Table altered.
2 where constraint_name='CHI_FK_PAR';
---------------------------------------------
CHI_FK_PAR DEFERRABLE
Constraint set.
insert into cons_child values (2,'llll')
*
ERROR at line 1:
ORA-02291: integrity constraint (SYSTEM.CHI_FK_PAR) violated - parent key not found
Constraint set.
1 row created.
SET constraints chi_fk_par immediate
*
ERROR at line 1:
ORA-02291: integrity constraint (SYSTEM.CHI_FK_PAR) violated - parent key not found
commit
*
ERROR at line 1:
ORA-02091: transaction rolled back
ORA-02291: integrity constraint (SYSTEM.CHI_FK_PAR) violated - parent key not found
deferrable会影响CBO的计划,并且正常情况下没有应用的必要,所以建议不要修改,而用系统默认的non deferrable
2. enable/disable validate/novalidate
3.REFERENCE 让人疑惑的地方
Table created.
2 foreign key (id,name) references wwm_father on delete set null);
Table created.
1 row created.
SP2-0734: unknown command beginning "insret int..." - rest of line ignored.
1 row created.
1 row created.
1 row created.
---------- --------------------
6 wwm
---------- --------------------
6
lll
----------
3
Oracle里面constraint说明相关推荐
- ORACLE中CONSTRAINT的四对属性
ORACLE中CONSTRAINT的四对属性 summary:在data migrate时,某些表的约束总是困扰着我们,让我们的migratet举步维艰,怎样利用约束本身的属性来处理这些问题呢?本文具 ...
- 默认约束 oracle,ORACLE约束(constraint):对象的强制规定
ORACLE约束(constraint):对象的强制规定 5种约束: NOT NULL 非空 NN UNIQUE 唯一 UK PRIMARY KEY 主键 PK FOREIGN ...
- oracle Deferrable constraint 详解以及用法.
1. 两种验证时机. Oracle的constraints(约束) 根据验证时机可以分成两种. case 1. 在每一句insert statement 执行时就会马上验证, 如果约束验证失败, ...
- Oracle中Constraint的状态参数initially与deferrable
在Oracle数据库中,关于约束的状态有下面两个参数: initially (initially immediate 或 initially deferred) ...
- oracle中constraint的使用,constraint用法总结 I .
Oracle中的约束简单介绍 约束 Including Constraints 在数据库中使用约束(constraints)是为了在该数据库中实施所谓的"业务规则"其实就是防止非法 ...
- 关于 Oracle DB CONSTRAINT约束的一些SQL ORA-02292: integrity constraint violated
ALTER TABLE table_name DISABLE CONSTRAINT constraint_name; select * from all_constraintswhere owner ...
- Oracle 约束 Constraint
约束简介 约束用于确保数据库数据满足特定的商业逻辑或者企业规则,如果定义了约束,并且数据不符 合约束,那么DML操作(INSERT.UPDATE.DELETE)将不能成功执行.约束包括NOT NULL ...
- oracle怎么关闭约束,Oracle约束enable/disablenovalidate
oracle 对constraint的开启和关闭共有四种:enable validate;enable novalidate;disable validate;disable novalidate.启 ...
- constraint PK_LDBACKUPTEXTINFO primary key (xx) using index tablespace lisi
Oracle数据库 constraint xx primary key(xx) 创建主键的方式 constraint TF_B_AIR_CONFIG_PK primary key(TYPE_ID)–单 ...
最新文章
- 计算机vb2级知识点,二级考试(VB)知识点细化(针对浙江省计算机等级考试)
- mysql.msi卸载_MySql安装与卸载的详细教程
- 金猪钱罐——青龙羊毛
- git提交代码,合并同步分支
- Java入门系列-11-类和对象
- Eclipse配置Tomcat服务器,通用方法
- 【王俊杰de人工智能实战课】第7次作业2
- python安装robotframework报错_Python3+RIDE+RobotFramework自动化测试框架搭建过程详解
- 基于windows server 2008 web服务器的性能,使用Windows Server 2008 R2理由_服务器评测与技术-中关村在线...
- mkdir 创建多级目录_Linux mkdir命令:创建目录(文件夹)
- PHP面试常考内容之面向对象(3) 1
- 虚拟机安装Windows7镜像
- 计算机取证程序论文,计算机取证论文参考文献推荐 计算机取证论文参考文献哪里找...
- android仿微信播放视频播放器,vue DPlayer 仿微信朋友圈视频播放效果
- ipad文献管理软件_ipad和电脑双向同步文献的奥秘
- D*(Dynamic A*) 算法详细解析
- CCS安装失败的原因
- 高精度地图-黑客又要开始装逼了!
- vue取数据库中的数据_Vue 数据怎么获取使用外部的数据
- 教你用Python写界面
热门文章
- Air700E开发板|移芯EC618|4G Cat.1模组:概述及PinOut
- python datetime需要安装_Python全栈工程师学习笔记 | Django的模型层
- Web前端培训项目实战—华为荣耀商城
- 基于Unity3D三维模型的动作插值(空间关键帧动画实现)
- TryHackMe | Blue Writeup (超干货详细msf渗透使用指南)
- 解决云开会难题,英特尔联合腾讯会议打造“会开会”的会议室
- NGUI HUD text 代码示例
- C语言中自定义函数返回数组类型
- HTML5超炫酷特效【天空中白云飘动CSS3特效】HTML+CSS+JavaScript
- 锐捷交换机配置SSH