IS NOT NULL vs <>

You can’t apply <> operator to fetch NON NULL data. It won’t return any data, though won’t produce any error either. See below. This query won’t return any data at all, despite dual table has 1 row.

select * from dual where dummy <> '';

You must use IS NOT NULL instead

select * from dual where dummy IS NOT NULL;

Same is valid for any other arithmetic comparison operators like =, >=, >, =<, <

 

Leave a comment

Your email address will not be published. Required fields are marked *