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的写法
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的写法