I have 2 packages A and B. Now package A references Package B
and Package B references Package A. How do you compile such
inter-dependent objects in PL/SQL

Answer Posted / anil

I assume this question as:
") I have 2 programs  A and B. Now program A references Program  B and Program B references Program A. How do you compile such inter-dependent objects in PL/SQL"

ANS:We can compile mutually referencing programmes using FORWARD declaration(specifying the declaration of one program in beginning of package body) inside a PACKAGE.
Example:
CREATE OR REPLACE PACKAGE test_pack
IS
gvar NUMBER:=0;
--PROCEDURE p1; --we can also achieve like this
END;
/

CREATE OR REPLACE PACKAGE BODY test_pack
IS
PROCEDURE p1; --forward declaration

PROCEDURE p2 
IS
BEGIN
P1;
END;

PROCEDURE p1
IS
BEGIN
p2;
END;

END;

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is cursor explain with example?

651


How you improve the performance of sql*loader? : aql loader

656


What are two statement types in sql?

635


What is the use of function "module procedure" in pl/sql?

771


how to run 'mysql' commands from a batch file? : Sql dba

683






What are character functions?

709


What is type and rowtype in pl sql?

635


Why do we need pl sql?

640


Can we use having without group by in sql?

633


What is varchar used for?

645


What is 19 null in sql?

611


what's the difference between a primary key and a unique key? : Sql dba

599


Does truncate free space?

609


How do I count records in sql?

618


how to get a list of indexes of an existing table? : Sql dba

609