Oracle case when
直接看例子:
select
(case sex when '1' then '男'
when '2' then '女'
else '未知' end)
as sex
from person
等价于 <==>
select
(case
when sex='1' then '男'
when sex='2' then '女'
else '未知' end)
as sex
from person
等价于 <==>
select decode(sex,'1','男','2','女','未知') as sex from person