ORACLE 的if else

a.
select
(case score when 0 then '无成绩' else '有成绩' end) as score
from table

select
(case score when 0 then '无成绩' when 60 then '好成绩' else '有成绩' end) as score
from table

b.
select
decode(score,0,'无成绩',20,'低成绩',60,'过得去','好成绩') as score
from table

-- 最后的好成绩是默认

猜你喜欢

转载自jslfl.iteye.com/blog/1584415
今日推荐