`
panshaobinSB
  • 浏览: 198554 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Oracle某表某字段存在空值,如何将其属性强制为“非空"?

 
阅读更多

什么意思?如果要将该字段加上非空约束

SQL> create table tttt as select 1 id,2 num from dual
  2    union all select 2,null from dual;

Table created

SQL> alter table tttt modify num not null;

alter table tttt modify num not null

ORA-02296: 无法启用 (W.) - 找到空值

SQL> alter table tttt modify num not null enable novalidate;

Table altered

SQL> insert into tttt values(3,null);

insert into tttt values(3,null)

ORA-01400: 无法将 NULL 插入 ("W"."TTTT"."NUM")
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics