SQL Programming Manual for Pascal
Program Compilation and Execution
HP NonStop SQL Programming Manual for Pascal—528614-001
5-28
Maximizing Local Autonomy
•
If the SQL executor subsequently tries to execute the uncompiled statement, the 
SQL executor tries again to automatically recompile the statement. If the statement 
still causes a compilation error or warning, the SQL executor returns a run-time 
error message to the program.
At run time, a program receives SQL compiler errors only when the SQL statement that 
produces the error executes.
Maximizing Local Autonomy
Local autonomy in a network-distributed database ensures that a program can access 
data on the local system, regardless of the availability of remote SQL objects. If your 
program accesses a network-distributed database, you can maximize local autonomy 
by:
•
Using a local partition, rather than the primary partition, as the table name for 
partitioned tables
•
Using DEFINEs
•
Using current statistics
•
Skipping unavailable partitions
For more information about managing applications for local autonomy, see the 
NonStop SQL Installation and Management Manual.
Using a Local Partition
If your program uses a remote partition, the SQL compiler looks for information about 
the table in a remote catalog. If the remote system is down, the SQL compilation fails; 
however, if your program uses a local partition, the SQL compiler looks for the 
information in a local catalog. Provided the local system and the data is available, the 
SQL compilation is successful.
The following example shows the concept of maximizing local autonomy. The PARTS 
table is a partitioned table that resides on the \NEWYORK and \CHICAGO systems:
A program declares a cursor defined as:
EXEC SQL DECLARE GET_PART_CURSOR CURSOR FOR
 SELECT PARTNUM, PARTDESC, PRICE, QTY_AVAILABLE
 FROM =PARTS
 WHERE PARTS.PARTNUM < 5000
 AND PARTS.PARTDESC = "V8 DISK OPTION";
\NEWYORK The first partition contains all rows in which PARTS.PARTNUM (the primary 
key) is less than 5000.
\CHICAGO The second partition contains all rows in which PARTS.PARTNUM is 5000 or 
greater. An index on the PARTDESC column of table PARTS is named 
IXPART.










