ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle 外键失效的一些测试

oracle 外键失效的一些测试

原创 Linux操作系统 作者:finalboss1987 时间:2012-09-07 10:51:15 0 删除 编辑
create table p(id int primary key,val int)
create table f(id int, constraint fkk foreign key (id) references p(id))
insert into f values(null)
drop table p
drop table f
 

create table p(id1 int,id2 int,constraint p12 primary key(id1,id2))
create table f(id1 int,id2 int,constraint f12 foreign key(id1,id2) references p(id1,id2))
insert into f values(1,null)
 
两次插入都成功,当外键约束遇见NULL的时候会失效,需要特别注意。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2281175/viewspace-742875/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2012-09-07

  • 博文量
    4
  • 访问量
    6077