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; 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2021-11-24
  • 2021-12-04
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
猜你喜欢
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案