HIVE SQL 判断空值函数

目录

  • nvl()
  • coalesce()

nvl()

select nvl(null,2);

输出:2

select nvl('',2);

输出:‘’

coalesce()

select coalesce(null,2);

输出:2

select coalesce('',2);

输出:‘’

select coalesce(null,null,2);

输出:2

*coalesce()支持三个及三个以上字段的空值判断;nvl()仅支持两个

你可能感兴趣的:(hive,sql,hadoop)