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")

猜你喜欢

转载自panshaobinsb.iteye.com/blog/1597431