PLSQL 14 2 SG

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

2

You CANNOT create a remote dependency in the Academy Application Express environment because there
is only one database. In real life, you (or the DBA) would first create a database link, which is a pointer to a
remote database, and then reference the database link within a local procedure.

3
4
5
6
7
8
9
10
11
These automatic timestamps are stored for all object types (table, view, index, synonym, and so on), not
only for PL/SQL subprograms.

12
13
14
15
Remember that procedure A calls procedure B, but not vice-versa. So there is no reference to A in the code
of B. Therefore, (re)compiling B stores B's new timestamp only.

16
The code of procedure A references procedure B. Therefore, when A is (re)compiled, the validity of B is
checked, just as with local dependencies. The timestamp of B is stored within procedure A.

17
When procedure A is executed, the validity and timestamp of B are checked. Because B is valid and its
timestamp is still 8:00 a.m., the local Oracle server knows that B cannot possibly have been recompiled
(therefore cannot have been altered) since 8:00 a.m.

Procedure A therefore remains valid and executes successfully.

18
This time, when procedure A is executed, the two timestamps of B are not equal. So the local Oracle server
knows that B must have been recompiled since it was last invoked from A.

19
The key point here is that A is not automatically recompiled, because it was not invalid at the start of its
execution. Instead, the execution fails and returns an unhandled exception. This is true even when B's
formal parameters were not changed by the recompilation at 11:00 a.m.

If the relationship had been a LOCAL dependency, and B's formal parameters had not changed, this step
would have executed successfully and A would have remained valid.

20
The second execution of procedure A forces a recompilation because its status was invalid. As always, the
actual parameters in A are compared with the formal parameters of B. Since they still match, A recompiles
and executes successfully and the remote timestamp is updated.

B's new timestamp is stored within B.

21
22
You cannot SELECT signatures from the data dictionary.

23
24
25
26
27
Since the recompilation of procedure B at 11:00 a.m. did not change its formal parameters (and therefore
they still match the actual parameters within procedure A), B's signature was not changed by its
recompilation. Therefore, when A is executed, the local and remote signatures are still equal and the
execution is successful.

28
• Remote Dependencies are when the Oracle database manages dependencies in a distributed
environment across a network.
• Signature Mode is the setting to check if a local subprogram is still valid, or must be invalidated by
checking the value a unique number calculated and stored each time a procedure is recompiled.
• Timestamp Mode is the setting to check if a local subprogram is still valid, or must be invalidated by
checking the value in the USER_OBJECTS dictionary view.

29
30

You might also like