Thursday, March 3, 2011

Oracle Raise an error message when more than one match found in function overloading

SET SERVEROUTPUT ON
DECLARE
     FUNCTION getArea(v_radious NUMBER, v_precision NUMBER) RETURN NUMBER IS
     l_pi NUMBER := 3.14;
     BEGIN
          RETURN TRUNC((l_pi *(v_radious ** 2)),v_precision);
     END;
     FUNCTION getArea(v_length NUMBER ,v_width NUMBER) RETURN NUMBER IS
     BEGIN
          RETURN(v_length * v_width); 
     END;
BEGIN
     DBMS_OUTPUT.PUT_LINE('Area of Circle is '|| getArea(6.4, 2));
     DBMS_OUTPUT.PUT_LINE('Area of Rectangle is '|| getArea( 6, 4));
END;
/
ORA-06550: line 14, column 50:
PLS-00307: too many declarations of 'GETAREA' match this call
ORA-06550: line 14, column 6:
PL/SQL: Statement ignored
ORA-06550: line 15, column 53:
PLS-00307: too many declarations of 'GETAREA' match this call
ORA-06550: line 15, column 6:
PL/SQL: Statement ignored

No comments:

Post a Comment

External Table

Oracle External Table External tables are defined as tables that do not resides in the database allows you to access data that is stor...