IT Tutorial

ORA-01843: not a valid month

I got ” ORA-01843: not a valid month ” error in Oracle database.

 

ORA-01843: not a valid month

 

Details of error are as follows.

ORA-01843 not a valid month

Cause: A date specified an invalid month. Valid months are: January-December, for format 
code MONTH, and Jan-Dec, for format code MON.

Action: Enter a valid month value in the correct format.



 

 

not a valid month

This ORA-01843 errors are related with the date specified an invalid month. Valid months are: January-December, for format code MONTH, and Jan-Dec, for format code MON.

 

TO_DATE Function

To solve this error, you should Use the “to_date” function on dates in the SQL Rule to ensure they are read successfully.

Example: to_date(’04/28/2021′, ‘MM/DD/YYYY’)

 

For example; If you run the following sql statement, you will get this error.

SELECT * FROM TEST_TABLE WHERE CREATED_DATE = '29/04/21';

 

You should use TO_DATE function as follows to solve this error.

SELECT * FROM TEST_TABLE WHERE CREATED_DATE = TO_DATE('29/04/21', 'DD/MM/YY');

 

You can read the following post to learn more details about TO_DATE Function.

PL/SQL Datetime Functions

 

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

 

 328 views last month,  2 views today

Exit mobile version