Reputation: 17478
I want to filter the records that COMMENTS attribute is null
I have tried
SELECT TABLE_NAME, COMMENTS FROM
(SELECT TABLE_NAME, COMMENTS FROM (select * FROM user_tab_comments))
WHERE COMMENTS != null;
But it didn't return the right output. How can I do it?
Upvotes: 3
Views: 17960
Reputation: 23381
NULL
is a state not a value, therefore you can't use normal operators on it. Use IS NULL
or IS NOT NULL
instead.
SELECT TABLE_NAME, COMMENTS
FROM (SELECT TABLE_NAME, COMMENTS FROM (select * FROM user_tab_comments))
WHERE COMMENTS IS NOT NULL;
Just saw that you don't need all those subqueries
SELECT TABLE_NAME, COMMENTS
FROM user_tab_comments
WHERE COMMENTS IS NOT NULL;
Upvotes: 9