Skip to content

G-7160: Always explicitly state parameter mode.

Major

Maintainability

Reason

By showing the mode of parameters, you help the reader. If you do not specify a parameter mode, the default mode is in. Explicitly showing the mode indication of all parameters is a more assertive action than simply taking the default mode. Anyone reviewing the code later will be more confident that you intended the parameter mode to be in, out or in out.

Example (bad)

1
2
3
4
5
6
7
8
9
create or replace package employee_api is
   procedure upsert (io_id             in out employees.id%type
                    ,in_first_name            employees.first_name%type
                    ,in_last_name             employees.last_name%type 
                    ,in_email                 employees.email%type 
                    ,in_department_id         employees.department_id%type
                    ,out_success       out    pls_integer);
end employee_up;
/

Example (good)

1
2
3
4
5
6
7
8
9
create or replace package employee_api is
   procedure upsert (io_id             in out employees.id%type
                    ,in_first_name     in     employees.first_name%type
                    ,in_last_name      in     employees.last_name%type 
                    ,in_email          in     employees.email%type 
                    ,in_department_id  in     employees.department_id%type
                    ,out_success       out    pls_integer);
end employee_up;
/