Oracle7 Server Distributed Systems Volume I: Distributed Data

Contents Index Home Previous Next

Procedures and Location Transparency

Location transparency is also provided by PL/SQL program units called procedures that contain SQL statements that reference remote data. For example, consider the procedure created by the following statement:

CREATE PROCEDURE fire_emp (enum NUMBER) AS 
BEGIN 
	DELETE FROM jward.emp@hq.acme.com 
		WHERE empno = enum; 
END; 

When a user or application calls the FIRE_EMP procedure, it is not apparent that a remote table is being modified.

A second layer of location transparency is possible if the statements in a procedure indirectly reference remote data using local procedures, views, or synonyms. For example, the following statement defines a local synonym:

CREATE SYNONYM emp FOR jward.emp@hq.acme.com; 

Consequently, the FIRE_EMP procedure can be defined with the following statement:

CREATE PROCEDURE fire_emp (enum NUMBER) AS 
BEGIN 
	DELETE FROM emp WHERE empno = enum; 
END; 

If the table JWARD.EMP@HQ is renamed or moved, only the local synonym that references the table needs to be modified. None of the procedures and applications that call the procedure require modification.


Contents Index Home Previous Next