totn Oracle Error Messages

Oracle / PLSQL: ORA-01847 Error Message

Learn the cause and how to resolve the ORA-01847 error message in Oracle.

Description

When you encounter an ORA-01847 error, the following error message will appear:

  • ORA-01847: day of month must be between 1 and last day of month

Cause

You tried to enter a date value, but you specified a day of the month that is not valid for the specified month.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

Enter a valid day of the month. You may want to consider using the TO_DATE function if you are not already using it.

For example, if you tried to execute the following SQL statement:

SELECT TO_DATE('2004/12/32', 'yyyy/mm/dd')
FROM dual;

You would receive the following error message:

Oracle PLSQL

Since there are not 32 days in December, you need to enter a valid number between 1 and 31 for the month of December, as follows:

SELECT TO_DATE('2004/12/31', 'yyyy/mm/dd')
FROM dual;

Learn more about the TO_DATE function.