Is an Oracle NOT LIKE expression not returning NULL?

I am trying to query a table with the following query:

select * from name where firstname NOT LIKE 'PETER%' 

It does not return any records where firstname is null. Is this some kind of mistake or is it the case? I come from the background of SQL Server and am confused with many things here.

+4
source share
2 answers

NULL does not match LIKE . You must explicitly request it with OR firstname IS NULL

+8
source

Any comparison with NULL returns "unknown", which in most cases matches "not true".

If SQL Server returns NULL values ​​for NOT LIKE 'PETER%' , then I would think of an error in SQL Server.

+1
source

Source: https://habr.com/ru/post/1396266/


All Articles