Solution to ORA-01810 format code appears twice

Source: Internet
Author: User
The result reported that the ORA-01810 format code had two errors. After the web query, it was found that there is a problem with the formatting string, which should not be repeat a format twice, otherwise Oracle

The result reported that the ORA-01810 format code had two errors. After the web query, it was found that there is a problem with the formatting string, which should not be repeat a format twice, otherwise Oracle

You must use the TO_DATE function.
SQL code
TO_DATE ('2017-08-24 00:00:00 ', 'yyyy-MM-DD HH: mm: ss ')

The results reported two errors in the ORA-01810 format code. after an online query, it was found that there was a problem with formatting the string. The format should not be repeated twice. Otherwise, Oracle would not know which placeholder range to parse the field, the correct format should be like this. MI is used to represent minutes, instead of ss in java.

SQL code
TO_CHAR ('2017-08-15 00:00:00 ', 'yyyy-MM-DD HH: MI: ss ')

Later, we found that for the 24-hour system, HH was not supported well and changed to the following format:
SQL code
TO_CHAR ('2017-08-15 00:00:00 ', 'yyyy-MM-DD HH24: MI: ss ')

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.