Tuesday, January 19, 2016

TO_NUMBER strange behavior in SQL Developer

Assumption:-
we have column ORDER_NUMBER that has some non numeric data present in it with numeric ones.

Observation:-
if we selected  select  TO_NUMBER(ORDER_NUMBER) AS ORDER_NUMBER
from table_name  in sql developer.

The above statement can give you error "ORA-01722: invalid number"  because the SQL Developer selected randomly 50 records and display them on screen.

So if we have any of the records that have non-numeric data then we will get the error and if we got all the numeric order_number then we will not get the error.


But if we use any order by or group by clause then we will definitely get the error because then oracle process them in all one set .



Thanks
Nawneet



No comments:

Post a Comment