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 ')