Skip to content

G-7150: Try to remove unused parameters.

Major

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
22
23
24
create or replace package body department_api is
   function name_by_id( -- NOSONAR: non-deterministic
      in_department_id in integer
     ,in_manager       in employees%rowtype
   )
      return departments.department_name%type is
      co_department_id  constant departments.department_id%type := in_department_id;
      l_department_name departments.department_name%type;
   begin
      <<find_department>>
      begin
         select department_name
           into l_department_name
           from departments
          where department_id = co_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
21
22
23
create or replace package body department_api is
   function name_by_id( -- NOSONAR: non-deterministic
      in_department_id in integer
   )
      return departments.department_name%type is
      co_department_id  constant departments.department_id%type := in_department_id;
      l_department_name departments.department_name%type;
   begin
      <<find_department>>
      begin
         select department_name
           into l_department_name
           from departments
          where department_id = co_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;
/