Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Please help with date conversion. ORA-01858: a non-numeric character was found ...

antobayNov 24 2020

Please I would be grateful for you help. I wrote this simple date conversion block but getting error when I tried to pass it as a parameter. When I run this on its own in SQL developer I get no error but when I run it in a pl/sql block i get the error -1858 ORA-01858: a non-numeric character was found where a numeric was expected.
The idea is to pass this variable w_date to a package to that use a column on a table with the 24Hr date time format column e.g. 12/05/2020 14:21:07'
I am running this in Oracle 12C database on windows 10.
Many thanks for you help in advance.

 declare 
  w_dat date;
 begin
  select to_date('12/05/2020 14:21:07','DD/MM/YYYY HH24:MI:SS') into w_dat from dual ;
  dbms_output.put_line(w_dat);
 end;

   error from the dbms_ouput below
 12-MAY-20
-1858 ORA-01858: a non-numeric character was found where a numeric was expected
image.png

Comments
Post Details
Added on Nov 24 2020
2 comments
3,093 views