orcle 查询出来的是空集给默认值的方法
经常会遇到这种情景,查询语句必须要有一个返回值,但是现在的查询条件没有符合的结果。今天遇到了这个问题,
解决方法:查询时用case when 这种方式
select case (select count(1) from table where ...)
when 0 then default
else (select 要查的内容 from tabel )where ...)
end
from dual;

经常会遇到这种情景,查询语句必须要有一个返回值,但是现在的查询条件没有符合的结果。今天遇到了这个问题,
解决方法:查询时用case when 这种方式
select case (select count(1) from table where ...)
when 0 then default
else (select 要查的内容 from tabel )where ...)
end
from dual;
