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的写法
oracle中decode和case的用法介绍
最新推荐文章于 2021-04-15 17:53:14 发布