ORA-01843 means Oracle read a month from a string and the value was not a month: a number above 12, or a month name in a language the session does not use. Most often the day and month are swapped between the string and the format model, as with American dates read in a European format. In Oracle AI Database 26ai the message reads An invalid month was specified.
Reproduce the Error
Example:
select to_date('15/13/2026', 'DD/MM/YYYY') from dual;
select to_date('03/15/2026', 'DD/MM/YYYY') from dual;
select to_date('15-MAR-2026', 'DD-MON-YYYY', 'nls_date_language = German') from dual;Output:
Error starting at line : 1
In command -
select to_date('15/13/2026', 'DD/MM/YYYY') from dual
Error at Command Line : 1 Column : 16
Error report -
SQL Error: ORA-01843: An invalid month was specified.
Error starting at line : 2
In command -
select to_date('03/15/2026', 'DD/MM/YYYY') from dual
Error at Command Line : 2 Column : 16
Error report -
SQL Error: ORA-01843: An invalid month was specified.
Error starting at line : 3
In command -
select to_date('15-MAR-2026', 'DD-MON-YYYY', 'nls_date_language = German') from dual
Error at Command Line : 3 Column : 16
Error report -
SQL Error: ORA-01843: An invalid month was specified.- 13 is not a month.
- 03/15/2026 is month-first, but the format reads the day first, so 15 is taken as the month.
- MAR is the English abbreviation; in German, March is MRZ.
Fix: Match the Format and the Language
Example:
select to_date('03/15/2026', 'MM/DD/YYYY') as us_style from dual;
select to_date('15-MRZ-2026', 'DD-MON-YYYY', 'nls_date_language = German') as german from dual;
select to_date('15-MAR-2026', 'DD-MON-YYYY', 'nls_date_language = English') as english from dual;Output:
US_STYLE ______________ 15-MAR-2026 GERMAN ______________ 15-MAR-2026 ENGLISH ______________ 15-MAR-2026
The third argument of TO_DATE sets the date language for this one call, so the result does not depend on the session's NLS settings.
Things to Know
- Exchange dates as YYYY-MM-DD; there is no doubt about the order.
- Month names depend on NLS_DATE_LANGUAGE: give it explicitly in TO_DATE when strings use names.
- Implicit conversions use the session's NLS_DATE_FORMAT, so the same SQL can fail for one user and work for another.
Related Guides
- Oracle Datetime Format Models Explained
- How to Fix ORA-01830: Date Format Picture Ends Before Converting Entire Input String in Oracle
Conclusion
ORA-01843 means the month in a string is not a valid month for the format and language. Check the order of day and month, use the right date language for month names, and prefer YYYY-MM-DD for data exchange.
