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

Explain the steps needed to create the scheduled job?

565


How do I make sql search faster?

559


Can we use ddl statements in stored procedure sql server?

520


What are the three forms of normalization?

531


How to install oracle sql developer?

570






How do sql databases work?

533


mention if it is possible to import data directly from t-sql commands without using sql server integration services? If yes, what are the commands? : Transact sql

564


Is sql dba a good career? : SQL DBA

535


How does cross join work?

504


What is difference between inner join and self join?

595


What is the difference between subquery and correlated query?

530


What is primary key in db?

521


Do triggers have restrictions on the usage of large datatypes, such as long and long raw?

690


What is sql profiler in oracle?

567


Mention what is the function that is used to transfer a pl/sql table log to a database table?

486