首页 > 其他分享 >orcle 查询出来的是空集给默认值的方法

orcle 查询出来的是空集给默认值的方法

时间:2023-03-20 10:46:40浏览次数:27  
标签:... orcle 空集 when 查询 默认值 select

经常会遇到这种情景,查询语句必须要有一个返回值,但是现在的查询条件没有符合的结果。今天遇到了这个问题,

解决方法:查询时用case when  这种方式

select case (select count(1) from table where  ...)

when 0 then default 

else (select 要查的内容 from tabel )where ...)

end 

from dual;

 

 

标签:...,orcle,空集,when,查询,默认值,select
From: https://www.cnblogs.com/CoolBinGao/p/17235455.html

相关文章