An ORA-01722 error occurs when an attempt is made to convert a character string into a number, and the string cannot be converted into a number.
below is query to reprduce the error
SQL> select * from table where columnname=to_number('234');
ORA-01722: invalid number
note-* this happen only when, only if columnname is of data type varchar
1 person found this helpful
Yes, this happens due to implicit datatype conversion by Oracle. Better , try to avoid it always while writing any sql/plsql.
Recommended :- use to_char like: a .session_id = to_char(6178567)
or a .session_id = '6178567' ( put it in single quotes).
Yes ,But why This is not happening Frequently. Some time It occurs, Some times it doesn't.
When the wrong data is not accessed, because the condition in the where clause filtered them before the implicit conversion takes place, then the error won't occur.