I have varaias procedures and functions within the same package. How can I reference some inside in my PL-SQL code?
PACKAGE : BOX1
PROCEDURE : CLOSE, SOMATOTAL
FUNCTION : TOTALNOTES
How can I reference SOMATOTAL within CLOSE?
I have varaias procedures and functions within the same package. How can I reference some inside in my PL-SQL code?
PACKAGE : BOX1
PROCEDURE : CLOSE, SOMATOTAL
FUNCTION : TOTALNOTES
How can I reference SOMATOTAL within CLOSE?
If you declare the objects only in the package body, simply make the declaration in order for the reference to work (ie declare SOMATOTAL before CLOSE). If you declare the objects in the package spec, you can call independently of the order. Example using statement in spec:
create or replace package CAIXA1 is
procedure FECHARCAIXA;
procedure SOMATOTAL;
function TOTALNOTAS return number;
end CAIXA1;
create or replace package body CAIXA1 is
procedure FECHARCAIXA is
begin
dbms_output.put_line('FECHARCAIXA');
SOMATOTAL;
end;
procedure SOMATOTAL is
begin
dbms_output.put_line('SOMATOTAL');
end;
function TOTALNOTAS return number is
begin
dbms_output.put_line('TOTALNOTAS');
end TOTALNOTAS;
end CAIXA1;
exec CAIXA1.FECHARCAIXA;
Expected output:
FECHARCAIXA
SOMATOTAL