执行insert语句时,如果某个字段是空串'',存到oracle中时变成null,要查出这样的记录要用where XXX is null语句
创建表
create table NULLTEST(T_char CHAR, T_varchar2 VARCHAR2(10), T_number NUMBER, T_date DATE);
|
插入空值
insert into NULLTEST(T_CHAR, T_VARCHAR2, T_NUMBER, T_DATE) values('', '', '', '');
|
下面的语句查不出来
select * from nulltest where T_CHAR = '' ; select * from nulltest where T_VARCHAR2 = '' ;
|
下面的能查出上面的记录
select * from nulltest where T_CHAR is null ; select * from nulltest where T_VARCHAR2 is null ; select * from nulltest where T_NUMBER is null ; select * from nulltest where T_DATE is null ;
|
阅读(842) | 评论(1) | 转发(0) |