Open nbroucke opened 2 months ago
@nbroucke thanks for reporting this issue.
I can reproduce it with the following code
create or replace package body department_api is
function name_by_id(in_id in departments.department_id%type)
return departments.department_name%type is
co_id constant departments.department_id%type := in_id;
l_department_name departments.department_name%type;
begin
if true then
select department_name
into l_department_name
from departments
where department_id = co_id;
select department_name
into l_department_name
from departments
where department_id = co_id;
end if;
return l_department_name;
exception
when no_data_found then
return null;
when too_many_rows then
raise;
end name_by_id;
end department_api;
/
It's related to the if
statement. Without the if
no G-5060 is reported.
We get a violation G-5060 : Avoid unhandled exceptions with this code (just showing part of the code) :
when we comment the IF statement the violation is no longer there :