如何在 NOT NULL 字段中存储 NULL?
我刚刚在我们的测试数据库中的 NOT-NULL 字段中发现了 NULL 值。他们怎么能到那里呢?我知道可以使用 NOVALIDATE 子句更改 NOT-NULL 约束,但这会更改 USER_OBJECTS 中表的last_ddl_time。该时间小于这些记录的创建日期。还有什么我忽略的吗?或者这肯定是某人的手工工作?
如果相关的话,表已分区并按索引组织。 Oracle版本是9.2
I just came across NULL values in NOT-NULL fields in our test database. How could they get there? I know that NOT-NULL constraints can be altered with NOVALIDATE clause, but that would change table's last_ddl_time in USER_OBJECTS. And that time is less than the date that those records were created. Is there something else I'm overlooking? Or is that someone's manual work for sure?
Table is partitioned and index-organized if that is relevant.
Oracle version is 9.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
NOT NULL
列条件与其他约束不同:您可以禁用 NOT NULL 约束,但如果您使用 NOVALIDATE 重新启用该约束,则该列不会被视为NOT NULL
。让我们构建一个小示例:现在,如果我禁用约束并使用 NOVALIDATE 重新启用它,Oracle 将不会将该列视为 NOT NULLABLE:
所以,我会说,如果 NOT NULLABLE 列中有 NULL 值(根据我的最后一个查询)您有一个错误(联系支持人员?)
The
NOT NULL
column condition is not like other constraints: you can disable a NOT NULL constraint but the column won't be consideredNOT NULL
if you reenable the constraint with NOVALIDATE. Let's build a small example:now if I disable the constraint and reenable it with NOVALIDATE, the column won't be considered NOT NULLABLE by Oracle:
So, I would say that if you have NULL values in a NOT NULLABLE column (as per my last query) you have a bug (contact support?)
检查约束是否已暂停/禁用
Check If the constraint are suspended / Disabled
您确定这些列确实为空吗?换句话说:
返回行?也许他们刚刚得到了不可显示的数据......
And you're sure these columns are really null? In other words:
returns rows? Perhaps they've just got non-displayable data...