Description

Resolving calls to subprograms

Demo

SQL>
SQL> declare-- from w w  w  . java 2 s.  c  o m
  2      function f_getArea_Nr(i_rad_nr NUMBER)
  3            return NUMBER
  4        is
  5             v_pi_nr NUMBER:=3.14;
  6       begin
  7            return v_pi_nr * (i_rad_nr ** 2);
  8       end;
  9       function f_getArea_Nr(i_length_nr NUMBER, i_width_nr NUMBER)
 10            return NUMBER
 11       is
 12       begin
 13            return i_length_nr * i_width_nr;
 14       end;
 15  begin
 16      DBMS_OUTPUT.put_line('Area (R=3): '||f_getArea_Nr(3));
 17      DBMS_OUTPUT.put_line('Area (R=3): '||f_getArea_Nr('3'));
 18  end;
 19  /
Area (R=3): 28.26
Area (R=3): 28.26

PL/SQL procedure successfully completed.

SQL>

There is no overload of the function f_getarea_nr with string parameter.

The next valid match is found by successfully converting a string into a number.

In that case, Oracle can find a unique match.

Related Topic