create or replace package check1
is
procedure p1(a1 integer);
procedure p1(a1 number);
end check1;
/
create or replace package body check1
is
procedure p1(a1 integer)
as
begin
dbms_output.put_line('Using Integer');
end p1;
procedure p1(a1 number)
as
begin
dbms_output.put_line('Using Number');
end p1;
end;
/
--The above code gets compiled successfully.
--But when you try to execute it ..
begin
check1.p1(8779);
end;
--See what happens..............
This concludes ONLY different native datatypes can be used in PLSQL OO implementation. Happy learning!!!!!
is
procedure p1(a1 integer);
procedure p1(a1 number);
end check1;
/
create or replace package body check1
is
procedure p1(a1 integer)
as
begin
dbms_output.put_line('Using Integer');
end p1;
procedure p1(a1 number)
as
begin
dbms_output.put_line('Using Number');
end p1;
end;
/
--The above code gets compiled successfully.
--But when you try to execute it ..
begin
check1.p1(8779);
end;
--See what happens..............
This concludes ONLY different native datatypes can be used in PLSQL OO implementation. Happy learning!!!!!
Comments
Oracle 10g includes improved overloading of numeric types like the following.
-- Create package specification.
CREATE OR REPLACE PACKAGE numeric_overload_test AS
PROCEDURE go (p_number NUMBER);
PROCEDURE go (p_number BINARY_FLOAT);
PROCEDURE go (p_number BINARY_DOUBLE);
END;
/
-- Create package body.
CREATE OR REPLACE PACKAGE BODY numeric_overload_test AS
PROCEDURE go (p_number NUMBER) AS
BEGIN
DBMS_OUTPUT.put_line('Using NUMBER');
END;
PROCEDURE go (p_number BINARY_FLOAT) AS
BEGIN
DBMS_OUTPUT.put_line('Using BINARY_FLOAT');
END;
PROCEDURE go (p_number BINARY_DOUBLE) AS
BEGIN
DBMS_OUTPUT.put_line('Using BINARY_DOUBLE');
END;
END;
/
-- Test it.
SET SERVEROUTPUT ON
BEGIN
numeric_overload_test.go(10);
numeric_overload_test.go(10.1f);
numeric_overload_test.go(10.1d);
END;
/