Oracle can I use scalar functions in WHERE Clause? or a NULL issue
Question
somehow I get never any results when I call: select * from table_1 t1 where t1.c1 IS NOT NULL and trim(t1.c1) != '' ;
trim(t1.c1) != '' part causes problems actually i return nothing.
Solution
Oracle is peculiar in that the empty string (''
) and NULL
are the same thing. It is as if you are saying:
trim(t1.c1) != NULL
Such a statement will never be true. Try:
trim(t1.c1) IS NOT NULL
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow