How to resolve ORA-01861 Error Message in Oracle database

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


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

ORA-01861: literal does not match format string


You tried to enter a literal with a layout string, however the size of the format string was once no longer the equal size as the literal.


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

Option #1

Re-enter the literal so that it matches the format string.

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

SELECT TO_DATE('20041308','yyyy/mm/dd')
FROM dual;

You would receive the following error message:

You could correct the SQL statement as follows:

SELECT TO_DATE('2004/08/13','yyyy/mm/dd')
FROM dual;

As a established rule, if you are using the TO_DATE function, TO_TIMESTAMP function, TO_CHAR function, and similar functions, make sure that the literal that you grant fits the format string that you have specified.

View a complete listing of all Oracle functions.