Skip to content

G-4260: Avoid inverting boolean conditions with NOT.

Minor

Maintainability, Testability

Reason

It is more readable to use the opposite comparison operator instead of inverting the comparison with not.

Example (bad)

1
2
3
4
5
6
7
8
declare
   l_color varchar2(7 char);
begin
   if not l_color != constants_up.co_red then
      my_package.do_red();
   end if;
end;
/

Example (good)

1
2
3
4
5
6
7
8
declare
   l_color types_up.color_code_type;
begin
   if l_color = constants_up.co_red then
      my_package.do_red();
   end if;
end;
/