top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Please explain about Forward Declaration in Oracle?

+2 votes
990 views
Please explain about Forward Declaration in Oracle?
posted Apr 22, 2015 by Archana

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Special sub program unit declaration called forward declaration, Consider below the example

In this pacakage, the first program unit is calling the calc_rating but calc_rating is defined last in the package.
if we are not declared the fwd declaration then it will raise the error While compiling this package. Package
compilation always happens top to bottom. For resolving this compilation issue, you should declare the fwd
declaration.

CREATE OR REPLACE PACKAGE BODY forward_pack 
IS
PROCEDURE calc_rating(. . .); -- forward 
declaration 
PROCEDURE award_bonus(. . .) 
IS  -- subprograms 
defined 
BEGIN -- in alphabetical 
order
calc_rating(. . .); 
. . .
END;

and

PROCEDURE calc_rating(. . .) 
IS
BEGIN
. . .
END;

END forward_pack; 
answer Apr 22, 2015 by Amit Kumar Pandey
...