Question : ORA - 01722 invalid number error occurring during varchar to number conversion

I have an Oracle view with one of it's line as - to_number(trunc (APO)) APO . This view has been operational for a number of years, yet just today I am now getting an error ORA - 01722 invalid number.

It is definitely this conversion code that is the problem as I am able to change the view and see the results of the view without the error.

This field must be number, and as I said has been this way for a long time without problem.

I am hoping that somebody can help me determine which entry it is in the feed table that is causing the error.

Help is appreciated.

Answer : ORA - 01722 invalid number error occurring during varchar to number conversion

So now we're getting somewhere. You have non-null entries that are non-numeric.

select trunc(' ') from dual

Error starting at line 1 in command:
select trunc(' ') from dual
Error report:
SQL Error: ORA-01722: invalid number
01722. 00000 -  "invalid number"

select trunc(trim(' ')) from dual

1 rows selected

Just add a trim() around your APO:

to_number ( trim(stu.ifp_offers.APO)) APO
Random Solutions  
 
programming4us programming4us