1.请问在ORACLE中对于varchar2型, ' '(空字符串)是否等于NULL?
2.在ORACLE中假如一个varchar2型字段不允许为空,但是有默认值,向这个字段中插入NUll时系统是返回错误还是插入默认值?
1.yes
2.如果你语句中插入null,会报错的。如果,你不在插入语句中没有对该列给值,它将使用默认值。
查询NULL要用is null 而不是用=null
如下面例子:
update table1 set col1 = null; 等价于 update table1 set col1 = ' '; 而 select col1 from table 1 where col1 = null; 或 select col1 from table 1 where col1 = ' ' ; 都取不出任何东西 要用 select col1 from table 1 where col1 is null;