ITeye博客

ORACLE 的if else

jslfl · 2012-07-10 17:12 · Oracle · 数据库 · decode · Markdown

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

-- 最后的好成绩是默认

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。