Skip to content

G-2150: Avoid comparisons with NULL value, consider using 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;
   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;
/