Skip to content

G-7450: Never return a NULL value from a BOOLEAN function.

Blocker

Reliability, Testability

Reason

If a boolean function returns null, the caller has do deal with it. This makes the usage cumbersome and more error-prone.

Example (bad)

1
2
3
4
5
6
7
8
9
create or replace package body my_package is
   function my_function return boolean
      deterministic
   is
   begin
      return null;
   end my_function;
end my_package;
/

Example (good)

1
2
3
4
5
6
7
8
9
create or replace package body my_package is
   function my_function return boolean
      deterministic
   is
   begin
      return true;
   end my_function;
end my_package;
/