I am trying to return a boolean value from a case statement but the compiler is complaining about a ORA-00936: missing expression error:
SELECT
CASE MYCOLUMN
WHEN NULL THEN true
ELSE
false
END,
FROM MYTABLE;
I also tried the following but it doesn't work:
SELECT
CASE MYCOLUMN
WHEN NULL THEN SELECT true
ELSE
SELECT false
END,
FROM MYTABLE;
Is it possible to do this?
You need the IS operator for NULL checks
SELECT CASE WHEN MYCOLUMN IS NULL
THEN 1
ELSE 0
END
FROM MYTABLE;
BOOLEAN type is not supported in SQL. It is supported only in procedural PL/SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With