Oracle not in 的坑

刚刚发现个数据问题,排查了下,结果又是oracle的坑,记录下

这次是关于not in的问题

select *from 
from v_xy_new_small_b a
where a.user_code not in (select user_code from v_xy_meigu_and_empployee)

我就是想剔除下重复的用户,结果发现,今天查不出数据了,昨天还是正常的,找了半圈,发现是Oracle的一些特性

如果这个子查询中,结果中有NULL值,那就会返回空结果集

后来一看的确是我的v_xy_meigu_and_empployee中有user-code为空的记录,

修改下:

select *from 
from v_xy_new_small_b a
where a.user_code not in (select user_code from v_xy_meigu_and_empployee where user_code is not null)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。