Reputation: 485
In Oracle SQL , how come this operations return no data found
SELECT job_id
FROM HR.EMPLOYEES
WHERE job_id NOT IN ('');
Shouldn't an empty string means we should get all the data ?
Upvotes: 0
Views: 35
Reputation: 1270593
Your interpretation is correct. But not in Oracle.
Oracle treats an empty string as a synonym for NULL
. And, because NOT IN (NULL)
returns NULL
for any comparison, nothing evaluates to TRUE (because NULL
is not true).
The behavior you expect is correct behavior and how any other database would interpret this.
Upvotes: 2