Oracle PL/SQL - What is the output: function overloading?

Question

What is the output of the following code?

declare 
     function f_getArea_Nr 
     (i_rad_nr NUMBER) 
        return NUMBER 
     is 
         v_pi_nr NUMBER:=3.14; 
     begin 
        return v_pi_nr * (i_rad_nr ** 2); 
     end; 
     function f_getArea_Nr 
     (i_length_nr NUMBER, i_width_nr NUMBER:=3) 
        return NUMBER 
     is 
     begin 
        return i_length_nr * i_width_nr; 
     end; 
begin 
   DBMS_OUTPUT.put_line('Area (R=3):' 
      ||f_getArea_Nr(3)); 
end; 
/ 
  
  


Click to view the answer

||f_getArea_Nr(3)); 
       * 
ERROR at line 19: 
ORA-06550: line 19, column 9: 
PLS-00307: too many declarations of 'F_GETAREA_NR'  
    match this call 
ORA-06550: line 18, column 4: 
 PL/SQL: Statement ignored

Note

More than one match was found so Oracle raised a special error.

Oracle tried to set the default value of the second parameter in the overloaded function but was unsuccessful.

Related Quiz