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

推荐订阅源

Recent Commits to openclaw:main
Recent Commits to openclaw:main
GbyAI
GbyAI
Y
Y Combinator Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
M
MIT News - Artificial intelligence
博客园_首页
B
Blog RSS Feed
Recorded Future
Recorded Future
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
D
DataBreaches.Net
IT之家
IT之家
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
T
The Blog of Author Tim Ferriss
B
Blog
The Cloudflare Blog
MyScale Blog
MyScale Blog
雷峰网
雷峰网
U
Unit 42
C
Check Point Blog
月光博客
月光博客
Blog — PlanetScale
Blog — PlanetScale
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
大猫的无限游戏
大猫的无限游戏
D
Docker
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
L
LangChain Blog
F
Fortinet All Blogs
腾讯CDC
Martin Fowler
Martin Fowler
I
InfoQ
J
Java Code Geeks
博客园 - Franky
Engineering at Meta
Engineering at Meta
人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志

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