oracle和hive关于空字符串和null的判断

首先看oracle的输出结果

with q1 as(
select
'' test1,
null test2
from dual)
select 
case when test1='' then '空字符串' 
     when test1 is null then '空'
     else '啥也不是' end test1,
case when test2='' then '空字符串' 
     when test2 is null then '空'
     else '啥也不是' end test1
from q1

在这里插入图片描述
再看hive的结果

with q1 as(
select
'' test1,
null test2
)
select 
case when test1='' then '空字符串' 
     when test1 is null then '空'
     else '啥也不是' end test1,
case when test2='' then '空字符串' 
     when test2 is null then '空'
     else '啥也不是' end test1
from q1

在这里插入图片描述
得出,hive会对null和’'做出判断,而oracle默认为null

猜你喜欢

转载自blog.csdn.net/weixin_42856363/article/details/112260080
今日推荐