Home > Database > Mysql Tutorial > ORA-01810格式代码出现两次的解决方案

ORA-01810格式代码出现两次的解决方案

WBOY
Release: 2016-06-07 17:18:56
Original
1550 people have browsed it

结果报ORA-01810 格式代码出现两次的错误.后来上网查询后,发现是格式化字符串有问题,其中不应该将某个格式重复两次,否则Oracle就

需要使用TO_DATE函数,一开始写成了
Sql代码
TO_DATE('2012-08-24 00:00:00','YYYY-MM-DD HH:mm:ss')
 
结果报ORA-01810 格式代码出现两次的错误.后来上网查询后,发现是格式化字符串有问题,其中不应该将某个格式重复两次,否则Oracle就不知道要从哪个占位区间去解析该字段了,正确的格式应该是这样的,用MI来代表分钟,而不是java中的ss

Sql代码
TO_CHAR('2012-08-15 00:00:00','YYYY-MM-DD HH:MI:SS')
 
后来发现对于24小时制,HH支持的不好,又改成一下格式:
Sql代码
TO_CHAR('2012-08-15 00:00:00','YYYY-MM-DD HH24:MI:SS')

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template