You have data in your table ACOUNT
in the column MONEY
that is not numeric.
Here is a demo:
DEMO
I assume that the reason why it is working when there is no where clause is because your tool is showing you only first 50 results... And when you add where clause and filter the data, then in your first 50 results there is a data that is not numeric.
You can change this in your tool by going to : Tools >> Preferences >> Database >> Advanced.
You can create this function:
CREATE OR REPLACE FUNCTION is_number (p_str IN VARCHAR2)
RETURN NUMBER
IS
l_num NUMBER;
BEGIN
l_num := to_number(p_str);
RETURN l_num;
EXCEPTION
WHEN others THEN
RETURN NULL;
END is_number;
/
That I have founded here: How does numeric comparison on Oracle VARCHAR column work?
And then with it you can use this code:
select *
from (select MONEY_c
, to_char(is_number(MONEY_c), 'FM999G999G999G999D99', 'NLS_NUMERIC_CHARACTERS='',.''') as money_2
from ACOUNT)
where money_2 is not null