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!

oracle error ORA-01858

AmivaSep 15 2017 — edited Sep 16 2017

hi

I am getting following error while running the following sql. If i run inner query alone it is working fine. if i run the whole query it is giving

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

01858. 00000 -  "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.

------------------------------------------------------

columns month and year are in varchar2(20) in the table abc.  please help me to fix this.

SELECT month,year,SUM(price) FROM (

select

to_char (to_date(month,'dd-Mon YYYY'), 'YYYYMM') as month

,to_char (to_date(month,'dd-Mon YYYY'), 'YYYY') as year

,nvl(price,0) as price

FROM abc)

GROUP BY month,year;

This post has been answered by BrunoVroman on Sep 15 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 13 2017
Added on Sep 15 2017
5 comments
1,005 views