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

Answers were Sorted based on User's Feedback



I have 2 packages A and B. Now package A references Package B and Package B references Package A. ..

Answer / nitin

With the use of forward declaration we can call other package

Is This Answer Correct ?    11 Yes 3 No

I have 2 packages A and B. Now package A references Package B and Package B references Package A. ..

Answer / subha

First compile package A and B spec then compile package body of both A and B.

Is This Answer Correct ?    4 Yes 1 No

I have 2 packages A and B. Now package A references Package B and Package B references Package A. ..

Answer / ss

i know sql so here A and B are two tables which both having Primary and foreign Key so from A's PK is referring in to B and B's PK referring in to  A 
OR select * from A inner join B on (A.id=B.AID)

Is This Answer Correct ?    3 Yes 1 No

I have 2 packages A and B. Now package A references Package B and Package B references Package A. ..

Answer / nitin

Forward declaration can be implemented for procedure only.In one package you can create inter-dependency but for package it is not possible.

Is This Answer Correct ?    3 Yes 2 No

I have 2 packages A and B. Now package A references Package B and Package B references Package A. ..

Answer / 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

More SQL PLSQL Interview Questions

What is composite primary key in sql?

0 Answers  


I have following column in the table. col1 1 a b c 2 3 d and I want to display it as num chars 1 a 2 b 3 c 4 d numbers in one column and letters in another column.

1 Answers   IBM, Saama Tech,


What is difference between rank () row_number () and dense_rank () in sql?

0 Answers  


What is a schema in sql?

1 Answers  


Can sql function call stored procedure?

0 Answers  






What is intersect?

1 Answers  


how many sql dml commands are supported by 'mysql'? : Sql dba

0 Answers  


In a PL/SQL block,which loop type should be used in a performance point of view & Why (as both loops can do the same task) 1) open - Fetch loop 2) for loop

4 Answers   JDA,


How do I make my sql query run faster?

0 Answers  


Is sql a backend language?

0 Answers  


what are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee (eno int(2),ename varchar(10)) ? : Sql dba

0 Answers  


what is hash join

1 Answers   NCR,


Categories