Skip to content

G-7310: Avoid standalone procedures – put your procedures 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 a major advantage compared to standalone procedures and functions.

Example (bad)

1
2
3
4
5
create or replace procedure my_procedure is
begin
   null;
end my_procedure;
/

Example (good)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
create or replace package my_package is
   procedure my_procedure;
end my_package;
/

create or replace package body my_package is
   procedure my_procedure is
   begin
      null;
   end my_procedure;
end my_package;
/