RT

解决方案 »

  1.   

    先把空值的更新为非空,然后加这个 not null 限制。
      

  2.   

    查询得到非空?
    用NVL(字段,非空值)
      

  3.   

    什么意思?如果要将该字段加上非空约束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")
      

  4.   

    alter table tttt modify num not null enable novalidate;使用这个命令表示对历史数据没有影响,但是以后的数据会有影响的。