Skip to content

G-7150: Try to remove unused parameters.

Minor

Efficiency, Maintainability

Reason

You should go through your programs and remove any parameter that is no longer used.

Example (bad)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
create or replace package body department_api is
   function name_by_id(in_department_id in departments.department_id%type
                      ,in_manager_id    in departments.manager_id%type)
      return departments.department_name%type is
      l_department_name departments.department_name%type;
   begin
      <<find_department>>
      begin
         select department_name
           into l_department_name
           from departments
          where department_id = in_department_id;
      exception
         when no_data_found or too_many_rows then
            l_department_name := null;
      end find_department;

      return l_department_name;
   end name_by_id;
end department_api;
/

Example (good)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
create or replace package body department_api is
   function name_by_id(in_department_id in departments.department_id%type)
      return departments.department_name%type is
      l_department_name departments.department_name%type;
   begin
      <<find_department>>
      begin
         select department_name
           into l_department_name
           from departments
          where department_id = in_department_id;
      exception
         when no_data_found or too_many_rows then
            l_department_name := null;
      end find_department;

      return l_department_name;
   end name_by_id;
end department_api;
/