oracle里面如何写case语句
转载:转载请保留本信息,本文来自http://www.51dibs.com/lp07/la/a2/l_a_e0ded31e059b8bd0.html
如下:
SELECT LogID,UserID,LogTime,Url,Description,(case OperateType when OperateType = 0 then 新增 when OperateType=1 then 修改 else 删除 end case) FROM LOG ????
1. case
SELECT LogID,UserID,LogTime,Url,Description,(
case
when OperateType = 0
then 新增
when OperateType=1
then 修改
else 删除
end ) FROM LOG
2.DECODE的写法:
SELECT LogID,UserID,LogTime,Url,Description,
decode(OperateType,0,新增,1,修改,删除) OperationName
FROM LOG
建议用DECODE的写法