I have a table called TABLE_TEMP with column AMOUNT as varchar2(20) I am executing below query:
SELECT to_number(AMOUNT) amt FROM TABLE_TEMP WHERE DC IN ('C','D');
Result for above query is
AMT
----
0
123
511
485
0
I want to fetch records where AMT > o and using below query for that
SELECT AMOUNT amt FROM TABLE_TEMP WHERE DC IN ('C','D') and to_number(AMOUNT) > 0;
getting error ORA-01722: Invalid number Please suggest me..
o
or0
? You have them both in your post... – Mureinikamount
column. The database is free to evaluate predicates in whatever order it believes will be most efficient. So it is perfectly legal to evaluate theto_number
predicate before thedc
predicate. – Justin Cave