I ran across a weird scenario where to_number function is not being able to convert the numbers stored in string data type column in one database but not in another.
So, to rule out all possible scenarios such as additional spaces, nulls, junk etc, I have selected only one single and applied to_number function on the column and I totally this is not the best practice saving numbers as strings.
Interestingly, the query executes fine in one database but in others.
The below query runs fine in development but in test database.
select column_name
from table_name
where to_number(column_name) = 1618
Also, when i run the below query in test, I get results with out any error.
select to_number(column_name) from table_name
When I move the to_number function to where clause, that is when I'm getting invalid number error.
Any thoughts?
Thanks...