Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 









ORA-01858: a non-numeric character was found where a numeric was expected



I do insert /*+APPEND*/ into new_table select <convert datatypes here> from old_table;

but the right types is DATE and in old table the types is VARCHAR ,

The problem is when i do select with convert to columns i get this error

select to_date(time_opened,'MM DD YYYYhh24:mi:ss') from tec.tec_t_archive;


ERROR at line 1:

ORA-01858: a non-numeric character was found where a numeric was expected

I see much DATE format in this columns like this

MM DD YYYYhh24:mi:ss

MM/DD/YYYY hh24:mi:ss

YYYY/MM/DD hh24:mi:ss

How I can see that all formats to date in this columns -

And how can to do insert with decode to all tables ?


Answer from Manfred:

I'm afraid that you have to analyze your data, probably you can select distinct substr(TIME_OPENED,1,8) to see all possible formats.

ORA-01858: a non-numeric character was found where a numeric was expected

Cause: The input data to be converted using a date format model was incorrect. The input data did not contain a number where a number was required by the format model.

Action: Fix the input data or the date format model to make sure the elements match in number and type. Then retry the operation.

The 2nd part is more difficult. I would write a function where I'm looking for a scheme in each found format and return a code which you can decode.


CREATE FUNCTION data_test (check_var varchar2) return number
   rc    number;
  if substr(check_var,3,1) = '/' then return 1 end if;
  if substr(check_var,3,1) = ' ' then return 2 end if;
  if ....
  else return 99;
  end if;


and then:


insert /*+APPEND*/ into new_table select
1,to_date(TIME_OPENED,'MM/DD/YYYY hh24:mi:ss'),
2,to_date(TIME_OPENED,'MM DD YYYY hh24:mi:ss'),
to_date('12319999','MMDDYYYY') ) --<default date> or null


..or something like this...



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.