ORA-01810格式代码出现两次的解决方案
Jun 07, 2016 pm 05:18 PM结果报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')

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Reduce the use of MySQL memory in Docker

How do you alter a table in MySQL using the ALTER TABLE statement?

How to solve the problem of mysql cannot open shared library

What is SQLite? Comprehensive overview

Run MySQl in Linux (with/without podman container with phpmyadmin)

Running multiple MySQL versions on MacOS: A step-by-step guide

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?

How do I configure SSL/TLS encryption for MySQL connections?
