Submitted by: ananth.oracle
Yes, we can call a packaged function in another package.
Example
CREATE OR REPLACE package VISION_SURGERY.test_a isfunction call_func(enter_date date) return varchar2;
end;
/
CREATE OR REPLACE package body VISION_SURGERY.test_a is
function call_func(enter_date in date) return varchar2 is
v_date varchar2(100);
begin
v_date:=to_char(enter_date,'Ddspth-Month-Year');
return v_date;
end;
end;
/
Package A is created
create or replace package test_b isprocedure
call_func_a;
end;
/
create or replace package body test_b is
procedure call_func_a is
v_date date;
v_date_mod varchar2(100);
begin
v_date := to_date('10/03/2009','dd/mm/yyyy');
v_date_mod:=test_a.call_func(v_date);
dbms_output.put_line('Date before modificaion is : '|| v_date);
dbms_output.put_line('Date after modificaion is : '|| v_date_mod);
end;
end;
/
Now execute the packaged procedure by
exec test_b.CALL_FUNC_A
Above answer was rated as good by the following members:
orasuman9, samareshp