首页 > Note > ORA-01861: 文字与格式字符串不匹配

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

2009年2月5日 stone 发表评论 阅读评论

ORA-01861: literal does not match format string
Cause: Literals in the input must be the same length as literals in the format string (with the exception of leading whitespace). If the "FX" modifier has been toggled on, the literal must match exactly, with no extra whitespace.

Action: Correct the format string to match the literal.

在SQL语句中日期类型字段值的设置、比较、显示如果直接使字符串方式('2009-02-04'),或者 使用to_date('2009-02-04')方式,  没有指定日期格式,则会报ORA-01861错误。
解决方法:使用to_date('2009-02-04' , 'yyyy-mm-dd') 替代以上方式。

分类: Note 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
您必须在 登录 后才能发布评论.