oracle与mysql语句对比(一)

  • 模糊查询
oracle: where like '%params%'
mysql: like concat('%', #{param}, '%')
  • 判断查询
oracle: select decode(1,'',1,2) from dual
mysql: select if(1='',1,2) from dual
  •  时间转换
时间转字符串
oracle: select to_char(sysdate,'yyyy-mm-dd HH24:mi:ss') dual
mysql:  select date_format(now(), '%Y-%m-%d'); 
字符串转时间
oracle: select to_date('2018-03-03 11:00:00','yyyy-mm-dd hh24:mi:ss') dual
mysql select str_to_date(‘2018-03-03 11:00:00’,’%Y-%m-%d %H:%i:%s’);