oracle的环境下判空

来源:互联网 发布:淘宝开店认证怎么修改 编辑:程序博客网 时间:2024/09/21 08:51

oracle 默认把 空字符串都当成 null 处理。mysql倒不一样。

mysql 里面 执行

select count(*)  from t_usr_pmsf where f_p_projman <> '';  7
select count(*)  from t_usr_pmsf where f_p_projman = '';  3
select count(*)  from t_usr_pmsf where f_p_projman is  not null ; 10
select count(*)  from t_usr_pmsf where f_p_projman is    null;  3
select count(*)  from t_usr_pmsf ;  13

 

oracle 里面执行

select count(*)  from t_usr_pmsf where f_p_projman <> '';   0
select count(*)  from t_usr_pmsf where f_p_projman = '';  0
select count(*)  from t_usr_pmsf where f_p_projman is  not null ;  382
select count(*)  from t_usr_pmsf where f_p_projman is    null;   33
select count(*)  from t_usr_pmsf ;  415

 

所以在mysql环境下写的代码需要全部重新改动判空。

判空方式    IFieldFilter ff= dq.createFieldFilter("p_projman", SATConstants.SQL_OP_IS_NULL, null);
   ff.setNot(true);  //取反
   dq.addFilter(ff);

原创粉丝点击