ORA-01843: not a valid month, ora-01843valid

Source: Internet
Author: User

ORA-01843: not a valid month, ora-01843valid

This problem was encountered during the code today, because oracle is rarely used and the query is located.

Suddenly dummies, there are a lot of posts that are due to the problem of nls_date_language, but also to change the session-level NLS_DATE_LANGUAGE to simplified Chinese, there are some other, and so on. I was speechless at the time. I think most of the landlords are playing oracle on their own. Although it is also a factor, if it is in a serious project, who will let you change this ?!


Later I found the correct method, as shown below:


To_date ('2017-06-24 00:00:00 ', 'yyyy-mm-dd hh24: mi: ss ')


Oracle Date Format Conversion

The description is not clear. I 'd like to know about it. There are two possibilities,
1. The date format of Table A is yyyyMMdd. You need to write to_date (date, 'yyyymmdd') in this way. Otherwise, the length is insufficient.
2. If a valid error is reported during to_date (date, 'yyyymmdd hh24miss '), your date format is incorrect, for example, the year, month, and number of days are invalid, for example, this is definitely not true between March 13, 9999 and march 32.
In addition, we recommend that you directly say the oracle error number when learning to use oracle,
ORA-01843 not a valid month

An invalid month is inserted into the oracle database.

It won't work if it is saved.

To_date (to_char (your_col, 'yyyy-mm-dd hh24: mi: ss'), 'yyyy-mm-dd hh24: mi: ss ')

Related Article

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.