萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> oracle教程 >> oracle裡面如何寫case語句

oracle裡面如何寫case語句

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

copyright © 萬盛學電腦網 all rights reserved