ORA-01861: literal does not match format string

2014-11-24 18:27:54 · 作者: · 浏览: 0

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


语句是


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,以免下次再次忘记。。。