CREATE OR REPLACE PACKAGE RIVUS.OVERLOADING
IS
FUNCTION COMPLEX(N NUMBER)
RETURN NUMBER;

FUNCTION COMPLEX(N PLS_INTEGER)
RETURN NUMBER;
END;
/
CREATE OR REPLACE PACKAGE BODY RIVUS.OVERLOADING
IS
— NUMBER 用 常に0を戻す
FUNCTION COMPLEX(N NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN 0;
END;
— PLS_INTEGER 用 常に1を戻す
FUNCTION COMPLEX(N PLS_INTEGER)
RETURN NUMBER
IS
BEGIN
RETURN 1;
END;
END;
/

 

 

declare
n number := 1 ;
p pls_integer := 2;
begin
dbms_output.put_line(rivus.overloading.complex(n));
dbms_output.put_line(rivus.overloading.complex(p));
end;
/