More than one match was found so Oracle raised a special error. : Overloading « Function Procedure Packages « Oracle PL/SQL Tutorial






SQL>
SQL> declare
  2      function getArea(i_rad NUMBER) return NUMBER
  3      is
  4          v_pi NUMBER:=3.14;
  5      begin
  6         return v_pi * (i_rad ** 2);
  7      end;
  8      function getArea(i_length NUMBER, i_width NUMBER:=3) return NUMBER
  9      is
 10      begin
 11         return i_length * i_width;
 12      end;
 13  begin
 14     DBMS_OUTPUT.put_line('Area (R=3):'||getArea(3));
 15  end;
 16  /
   DBMS_OUTPUT.put_line('Area (R=3):'||getArea(3));
                                       *
ERROR at line 14:
ORA-06550: line 14, column 40:
PLS-00307: too many declarations of 'GETAREA' match this call
ORA-06550: line 14, column 4:
PL/SQL: Statement ignored


SQL>








27.19.Overloading
27.19.1.Overloading calls
27.19.2.Number of parameters
27.19.3.Names of parameters
27.19.4.Datatype family of parameters
27.19.5.There are some restrictions on overloading:
27.19.6.More than one match was found so Oracle raised a special error.