ORA-01861: literal does not match format string

遇到这个错误 ORA-01861: literal does not match format string

语句是, cuug本周六晚免费Oracle网络公开课《反恐精英:动态SQL和SQL注入》,名额有限,赶紧报名吧!

between ‘time1’ and ‘time2’

查询出来是

ORA-01861: 文字与格式字符串不匹配

解决方法

to_date('time1' , 'yyyy-mm-dd hh24:mi:ss')

或者

比较时间也可以将数据的时间字段to_char('time1','yyyy-mm-dd hh24:mi:ss').变成字符串,再去按字符串比较.

当然你的字符串'time1'也要to_char(to_date('time1','yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss').

再次MARK,以免下次再次忘记。。。

猜你喜欢

转载自cuug789.iteye.com/blog/2016302
今日推荐