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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1902173/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 04:45:02  来源:igfitidea点击:

ORA-01861: literal does not match format string

sqloracleoracle9iora-01861to-date

提问by OscarRyz

I'm pretty sure this is something really silly.

我很确定这是一件非常愚蠢的事情。

Instead of spending another 10 minutes with this ( or better said, while I spend another 10 minutes with this ) I'll ask it here in parallel.

我不会再花 10 分钟(或者更好的说法,而我又花 10 分钟),我会在这里并行询问。

What's wrong with the following statement:

以下语句有什么问题:

select to_date( '30/10/2009 18:27:35', 'DD/MM/YYY HH24:MI:SS') from dual

The error message is:

错误信息是:

Error: ORA-01861: literal does not match format string

SQLState:  22008
ErrorCode: 1861
Position: 0

回答by Thomas Jones-Low

'DD/MM/YYY HH24:MI:SS'

'DD/MM/YYY HH24:MI:SS'

Try this with four Y's

用四个 Y 试试这个

'DD/MM/YYYY HH24:MI:SS'

'DD/MM/YYYY HH24:MI:SS'