totn Oracle Error Messages

Oracle / PLSQL: ORA-01861 Error Message

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

Description

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

  • ORA-01861: literal does not match format string

Cause

You tried to enter a literal with a format string, but the length of the format string was not the same length as the literal.

Resolution

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:

Oracle PLSQL

You could correct the SQL statement as follows:

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

As a general 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 provide matches the format string that you've specified.

View a complete listing of all Oracle functions.