首页 >数据库 >mysql教程 >oracle里面如何写case语句

oracle里面如何写case语句

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-07 16:21:501176浏览

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 th

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

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn