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

推荐订阅源

I
Intezer
宝玉的分享
宝玉的分享
V
Visual Studio Blog
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
博客园 - Franky
J
Java Code Geeks
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
D
Docker
IT之家
IT之家
小众软件
小众软件
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
N
News | PayPal Newsroom
量子位
The Last Watchdog
The Last Watchdog
The Register - Security
The Register - Security
PCI Perspectives
PCI Perspectives
罗磊的独立博客
S
Secure Thoughts
WordPress大学
WordPress大学
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
B
Blog
T
Threatpost
The GitHub Blog
The GitHub Blog
博客园 - 叶小钗
U
Unit 42
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Help Net Security
Cloudbric
Cloudbric
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
人人都是产品经理
人人都是产品经理
H
Heimdal Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Last Week in AI
Last Week in AI
Jina AI
Jina AI
O
OpenAI News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
美团技术团队

博客园 - 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