oracle 查询为空返回指定值,及满足条件返回指定值

查询结果存在为空给与一个默认值 

 nvl(h.date_type, '时间类型') as dateType

根据条件判断返回对应值

第一种:

 case
         when h.date_time= 0 then
          '7天'
         when h.date_time= 1 then
          '半个月'
         when h.date_time = 2 then
          '一个月'
       end as dateTime

 第二种:

decode(h.yqsj,'0','7天','1','半个月','一个月)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章