Home  >  Article  >  Database  >  What should I do if ora01843 invalid month appears?

What should I do if ora01843 invalid month appears?

藏色散人
藏色散人Original
2020-03-31 10:34:427887browse

What should I do if ora01843 invalid month appears?

What should I do if ora01843 invalid month appears?

When executing the following SQL statement

select TO_DATE('01-FEB-1988', 'DD-MON-YYYY') from dual;

the following error occurred:

What should I do if ora01843 invalid month appears?

Restart I checked the date format of the current system time and found the following:

Execution:

SELECT TO_CHAR(sysdate, 'DD-MON-YYYY','NLS_DATE_LANGUAGE = ''SIMPLIFIED CHINESE''') Chn,
        TO_CHAR(sysdate, 'DD-MON-YYYY', 'NLS_DATE_LANGUAGE = American') Ame,
        TO_CHAR(sysdate, 'DD-MON-YYYY', 'NLS_DATE_LANGUAGE = Japanese') Jap,
        TO_CHAR(sysdate, 'DD-MON-YYYY', 'NLS_DATE_LANGUAGE = english') Eng
FROM DUAL;

The following results appear:

What should I do if ora01843 invalid month appears?

By SQL statement , it can be seen that the TO_CHAR function in the first and fourth line obtains the system time respectively for china, American, Japanese, English

. From the result diagram, it can be seen that the time format under china and Japanese is 27-7 Month-2018

It can be seen that in the above problem, if you want to convert the time format into "DD-MON-YYYY", an ORA-01843 error will occur, because the system will not Identify English MON;

So the solution is as follows:

1. Change the time in select TO_DATE('01-FEB-1988', 'DD-MON-YYYY') from dual; Change the field to Chinese format, that is, "01-February-1998";

2. Set the format of its NLS_DATE_LANGUAGE to Aerican or English

ALTER SESSION SET nls_date_language = 'SIMPLIFIED CHINESE';

Recommendation: " mysql video tutorial

The above is the detailed content of What should I do if ora01843 invalid month appears?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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