Functions should not reach their end without returning a value
ZPA rule for PL/SQL and Oracle SQL · FunctionWithoutReturn
A function that reaches its END without running a RETURN statement raises ORA-06503 ("PL/SQL: Function returned without value") when it is called. Oracle warns about some of these functions at compile time (PLW-05005), only when PLSQL_WARNINGS enables it, and not about an exception handler that falls through. That handler is the usual cause: it logs the error and then reaches the end of the function.
This rule reports a function when execution can reach its END, or the end of one of its own exception handlers, without a RETURN. A RAISE, a call to raise_application_error, or a call to a procedure of the same file that always raises ends the path. A CASE statement without ELSE does not fall through when no branch matches: Oracle raises CASE_NOT_FOUND. A loop without an EXIT does not fall through either. Pipelined functions, functions with a GOTO and functions with conditional compilation are not checked.
Examples
create or replace function stock_level(p_item number) return number is
l_level number;
begin
select qty into l_level from warehouse_stock where item_id = p_item;
return l_level;
exception
when no_data_found then
audit_pkg.note('no stock row for ' || p_item);
end;
create or replace function stock_level(p_item number) return number is
l_level number;
begin
select qty into l_level from warehouse_stock where item_id = p_item;
return l_level;
exception
when no_data_found then
audit_pkg.note('no stock row for ' || p_item);
return 0;
end;