思路:将这些数据字符串转换为多行记录,然后再进行对比。
参考了:oracle怎样将字符串转为多行_雅冰石的博客-CSDN博客
#查出SMITH,jiao,zhangsan,lisi这些人中哪些人没在scott.emp里
select * from(
with a as
(
select ',SMITH,jiao,zhangsan,lisi' name
from dual
)
select regexp_substr(name,'[^,]+',1,rownum) name
from a
connect by rownum<=length(regexp_replace(name,'[^,]+'))
)
where name not in (select ename from scott.emp)