G-2150: Never use comparisons with NULL values, use IS [NOT] NULL.

Blocker

Portability, Reliability

Reason

The NULL value can cause confusion both from the standpoint of code review and code execution. You must always use the IS NULL or IS NOT NULL syntax when you need to check if a value is or is not NULL.

Example (bad)

1
2
3
4
5
6
7
8
declare
   l_value integer;
begin
   if l_value = null then 
      null; -- Nothing ever equals null, so this code will never be run
   end if;
end;
/

Example (good)

1
2
3
4
5
6
7
8
declare
   l_value integer;
begin
   if l_value is null then
      null;
   end if;
end;
/