G-7410: Avoid standalone functions – put your functions in packages.

Minor

Maintainability

Reason

Use packages to structure your code, combine procedures and functions which belong together.

Package bodies may be changed and compiled without invalidating other packages. This is major advantage compared to standalone procedures and functions.

Example (bad)

1
2
3
4
5
create or replace function my_function return varchar2 is
begin
   return null;
end my_function;
/

Example (good)

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