# G-7250: Never use RETURN in package initialization block.

Minor

Maintainability

## Reason

The purpose of the initialization block of a package body is to set initial values of the global variables of the package (initialize the package state). Although return is syntactically allowed in this block, it makes no sense. If it is the last keyword of the block, it is superfluous. If it is not the last keyword, then all code after the return is unreachable and thus dead code.

  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 employee_api as g_salary_increase types_up.sal_increase_type(4,2); procedure set_salary_increase (in_increase in types_up.sal_increase_type) is begin g_salary_increase := greatest(least(in_increase ,constants_up.max_salary_increase()) ,constants_up.min_salary_increase()); end set_salary_increase; function salary_increase return types_up.sal_increase_type is begin return g_salary_increase; end salary_increase; begin g_salary_increase := constants_up.min_salary_increase(); return; set_salary_increase(constants_up.min_salary_increase()); -- dead code end employee_api; / 
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 create or replace package body employee_api as g_salary_increase types_up.sal_increase_type(4,2); procedure set_salary_increase (in_increase in types_up.sal_increase_type) is begin g_salary_increase := greatest(least(in_increase ,constants_up.max_salary_increase()) ,constants_up.min_salary_increase()); end set_salary_increase; function salary_increase return types_up.sal_increase_type is begin return g_salary_increase; end salary_increase; begin g_salary_increase := constants_up.min_salary_increase(); end employee_api; /