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 can sql server reporting services do?

788


What is the difference between instead of trigger and after trigger?

692


difference between anonymous blocks and sub-programs.

817


How to place comments in pl/sql?

792


How do I view a procedure in sql?

722






Explain about various levels of constraint.

694


What is before and after trigger?

689


Can you join a table to itself?

705


Is left join inner or outer?

752


First round ------------------- - Procedure - Packages - Views - Virtual tables - Can we use dcl with in function? - Joins and few scenarios - Triggers and its type - Pragma, type and its functionality - How to create db link in oracle - Materialized view - How to find duplicate values from table? - Cursor and its functionality - Write a script to display friday and its date from a entire year. - Exception Handling Second round ------------------------ Gave a scenario like. Need to write a function to perform. When user try to change a password. It must not be last five password and a given password can be combination of characters, symbols, upper and lower case.

1328


How do I run a program in pl sql?

694


what is rollback? : Sql dba

753


How does a trigger work?

711


how to return query output in html format? : Sql dba

843


How do you use a while loop in pl sql?

710