My Oracle Support Banner

Query using TO_DATE TO_CHAR failing with ORA-01858 or ORA-01843 (Doc ID 790098.1)

Last updated on FEBRUARY 16, 2022

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Gen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine) - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.

Symptoms

NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the Oracle sample or bulit-in schema(s), Public Documentation delivered with an Oracle database product or other training material.  Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner.

An error is being generated on some clients when executing a query using TO_DATE(TO_CHAR .

The errors indicate the data is invalid for what is expected to be returned.  If you add/change a query hint the error may change slightly.

You may see:

ORA-01858: a non-numeric character was found where a numeric was expected
ORA-01843: not a valid month

An example of the scenario:

The DATA in SCOTT.EMP is as follows:

 

Changes

A session, instance, or database NLS parameter has changed or you may have upgraded clients.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.