rules repository

G-7440

🆓
Warning

Never use OUT parameters to return values from a function.

Reason

A function should return all its data through the return clause. Having an out parameter prohibits usage of a function within SQL statements.

Example

Non-Compliant Example

create or replace package body my_package is
   function my_function(out_date out date) return boolean
      deterministic
   is
   begin
      out_date := sysdate;
      return true;
   end my_function;
end my_package;
/
Issues
LineColumnMessage
234Avoid OUT parameter in function my_function.

Compliant Solution - ★★★★★

create or replace package body my_package is
   function my_function return date
      deterministic
   is
   begin
      return sysdate;
   end my_function;
end my_package;
/

References