日期:2014-05-17  浏览次数:20776 次

关于oracle '' 的问题,求解惑
select count(case when tid='' then 1 else 0 end) from   (select '' as tid  from dual)
返回1

select count(*) from (select '' as tid   from dual) where tid=''
返回0
oracle

------解决方案--------------------
引用:
when 问什么能识别这个条件,where为什么不行,我把两个例子放在一起就是想问这个?

第一个 CASE WHEN ..ELSE 那无论如何都或有一个记录 不是0 就是 1
第二个 明显是没有记录,因为条件为FALSE了,   COUNT(*)自然就是0了