Search code examples
sqloracle-databaseoracle12c

Oracle SQL: ANY + IS NULL


I need to check several fields with NULL. Of course I can do it with OR.

SELECT * FROM table WHERE f1 IS NULL OR f2 IS NULL OR f3 IS NULL

But there is ANY which works fine with logical operations.

Is it possible to do something like that in Oracle's SQL?

SELECT * FROM table WHERE ANY (f1, f2, f3) IS NULL

I use Oracle 12c.


Solution

  • On the inverse of Tim's anser, you can use GREATEST or LEAST to look where any value is NULL

    select * from dual where greatest('a',2,3,null) is null;