Oracle数据库 not in 筛选不出来 空值条件的数据
sql如下:
select a.code from A a where a.code not in ('HH订单');
能查询出来除了 HH订单 code中有值的所有数据但是 code字段没有值为null的数据是查询不出来的。
原因:因为oracle数据库 null作为一个单独的条件 需要特殊处理。
需要在sql中加 or a.code is null 的条件进行处理
select a.code from A a where a.code not in ('HH订单') or a.code is null ;
这样就能查询出来 非 HH订单 的所有数据了!