2015.7.17 case when then else end用法Oralcle与SQLserver一致
SELECT
CASE airway_point_type_id
WHEN 1 THEN 'VOR'
WHEN 2 THEN 'VOR/DME'
WHEN 3 THEN 'NDB'
WHEN 10 THEN 'P字点'
WHEN 11 THEN '五字代码点'
ELSE '其它' END
航路点类型
FROM AIRWAY_POINT
GROUP BY AIRWAY_POINT_TYPE_ID
或者
select
case when max(sup_no) is null or to_number(to_char(sysdate,'yyyy')||'01')> max(sup_no)
then to_number(to_char(sysdate,'yyyy')||'01')
else max(sup_no)+1
end nextcur
from EX_VERSION
或者
select
case when g.val_rnp<0
then 'RNAV '|| to_char(0-g.val_rnp)
when g.val_rnp>=0 then 'RNP '|| to_char(g.val_rnp)
else ''
end RNP值
case when的嵌套用法
case when g.val_rnp<0 then
case when 0-g.val_rnp <1 then 'RNAV '|| to_char(0-g.val_rnp,'0.9')
else 'RNAV '|| to_char(0-g.val_rnp) end
when g.val_rnp>=0 then
case when g.val_rnp <1 then 'RNP '|| to_char(g.val_rnp,'0.9')
else 'RNP '|| to_char(g.val_rnp) end
else '' end RNP值,