惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recorded Future
Recorded Future
爱范儿
爱范儿
Y
Y Combinator Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
腾讯CDC
罗磊的独立博客
阮一峰的网络日志
阮一峰的网络日志
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
T
Tailwind CSS Blog
Attack and Defense Labs
Attack and Defense Labs
G
GRAHAM CLULEY
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
C
Cyber Attacks, Cyber Crime and Cyber Security
T
The Blog of Author Tim Ferriss
T
The Exploit Database - CXSecurity.com
博客园 - 叶小钗
Latest news
Latest news
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
量子位
S
Security @ Cisco Blogs
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
美团技术团队
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
IT之家
IT之家
U
Unit 42
Project Zero
Project Zero
B
Blog
博客园 - 【当耐特】
D
DataBreaches.Net
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Hugging Face - Blog
Hugging Face - Blog
宝玉的分享
宝玉的分享
The Register - Security
The Register - Security
F
Full Disclosure
Vercel News
Vercel News
NISL@THU
NISL@THU
AWS News Blog
AWS News Blog
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
T
Threatpost
Martin Fowler
Martin Fowler
Engineering at Meta
Engineering at Meta
T
Tor Project blog
M
MIT News - Artificial intelligence
V
V2EX

博客园 - zqf620

.Net PetShop 3.0中购物车总价计算的bug .NET PetShop 3.0 FAQ .NET方向高级开发人员面试时应该事先考虑的问题 (zt) UML中的图 从一组数中每次抽取出一个数,并规定了每个数出现的概率 从一个表中随即抽取100条记录 PL/SQL User's Guide and Reference, Release 2 (9.2) chm版 下载 Oracle中实现自动增长列 在开发过程中运用UML 输出到html页面的字符串的格式化 在DataGrid控件中编辑数据项 在DataGrid控件中获取数据项中各列的数据内容 DataGrid控件的分页 DTD简介 W3C XML Schema (XSD) XML相关技术概览 将web窗体页文件(test.aspx)转换成用户控件文件(test.ascx) access作为后台数据库遇到的访问权限问题 HTML实体
novalidate选项无效的问题
zqf620 · 2007-02-04 · via 博客园 - zqf620

 novalidate选项无效的问题:       
平台:Oracle9i Enterprise Edition Release 9.2.0.1.0 for Windows

--创建一个带主键约束的表
create table temp(
temp_id number(3) constraint pk_temp primary key,
temp_desc varchar(20) );

--失效主键约束
alter table temp
disable constraint pk_temp;

--插入数据行
insert into temp values(1,'Record One');
insert into temp values(1,'Record Two');
insert into temp values(3,'Record Three');
insert into temp values(4,'Record Four');

--提交
commit;

--使用novalidate选项启用约束
alter table temp
enable novalidate constraint pk_temp;


================================================================
上面这一句报错,why?
alter table temp
*
ERROR at line 1:
ORA-02437: cannot validate (TSP3.PK_TEMP) - primary key violated
=================================================================

--解答:
--因为主键约束没有被定义为可延迟的(deferrable)
--所以,即使使用novalidate启用约束,还是会表的数据上应用约束

---------------------------------
--解决方案:
--删除主键约束
alter table temp
drop primary key keep index;

--重新添加主键约束,状态为可延迟、禁用
alter table temp
add constraint pk_temp primary key(temp_id) deferrable disable;

--使用带novalidate选项来启用约束
alter table temp
enable novalidate constraint pk_temp;

--一切ok