[ Team LiB ] |
9.8 Compilation DependencyConcerning just packages, a specification must exist and compile without errors before the package body can compile. 9.8.1 Scenario 1The following is a package specification and body. There is one procedure.
Figure 9-5 illustrates the package PK and the visible procedure P1. Additionally, there is a second package, AX. An AX procedure uses the procedure P1. Figure 9-5. Package Body Referencing Another Package.The body of AX is dependent on the specification of PK. Specifically, the body of the procedure A1 calls PK.P1. The body of AK becomes invalid if we recompile the PK specification. The body of AK becomes invalid if we recompile the AK specification�recompiling a package specification always invalidates the body. Recompiling the PK body or AX body has no impact to other code. This is always the case. For any package, recompiling the package body is an isolated event that will not affect any other stored procedure. Recompiling a package specification will invalidate the associated package body. It may also affect the bodies of other packages. This would be the case when the body code calls procedures in the recompiled spec. The following summarizes the package compilation order.
9.8.2 Scenario 2Two packages can have their body dependent on each other's package specification. The following illustrates this case. The first package is PK. The second package is AX. A PK procedure references an AK procedure. An AX procedure references a PK procedure. See Figure 9-6.
Figure 9-6. Two Interdependent Packages.To compile the four program units, two specs and two bodies, the package specifications must be compiled first, then the bodies. The code for this shows the package specifications first, then the bodies.
Recompiling has the following effects.
Recompiling a body affects nothing, but recompiling a specification could have wide implications by invalidating the body of that package plus many other package bodies. |
[ Team LiB ] |
No comments:
Post a Comment