SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Name Resolution, Similarity Checks, and Automatic 
Recompilation
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
8-6
Compile-Time Name Resolution for SQL/MP Objects
For more information on the SYSTEM_DEFAULTS table, see the SQL/MX Reference 
Manual.
Compile-Time Name Resolution for SQL/MP Objects
Compile-time name resolution is an SQL/MX extension you use to compile a module 
with statements that refer to SQL/MP tables or views with class MAP DEFINEs. For 
each statement, the SQL/MX compiler prepares a plan that is specific to, and 
optimized for, the physical table referenced in the file attribute of the DEFINE at the 
time of compilation. 
By using compile-time resolution, you can also reinitialize the DEFINEs to values that 
differ from those used when the module was first compiled, and then recompile the 
module to prepare plans for a different set of tables than the application was originally 
built to process, without changing the source code of the application.
To use compile-time name resolution to prepare two or more applications from the 
same source module, where each application processes its own set of tables, consider 
using the targeting technique of module management. See Targeting on page 17-12. If 
you do not use this technique, the compiled module file of the second application 
overwrites the module file of the first application. 
Late Name Resolution 
Late name or run-time resolution is an SQL/MX extension that enables an embedded 
SQL program to use class MAP DEFINEs and PROTOTYPE host variables in place of 
table names in DML statements. PROTOTYPE host variables can be used for SQL/MP 
and SQL/MX objects. During explicit SQL compilation, the SQL/MX compiler uses the 
tables from the DEFINEs or PROTOTYPE (if they are available) to generate a query 
execution plan for each DML statement. At run time, you can control which table the 
statement processes by changing the table name in the value of a DEFINE or by 
passing the table name in the value of a host variable (for PROTOTYPE host 
variables). You can specify the same table as the one that was originally compiled, or 
you can specify a different table.
Each time a DML statement executes (or a cursor is opened), the SQL/MX executor 
compares the name of the table for which the plan was compiled against the name 
taken from either the run-time DEFINE or the host variable. If the run-time DEFINE 
does not exist, the SQL/MX executor uses the compile-time DEFINE specified in the 
module. If the compile-time and run-time names do not match, the SQL/MX executor 
performs a similarity check of the tables to determine if the query execution plan of the 
DML statement is still operable. If the similarity check fails (or is disabled), the SQL/MX 
executor, by default, invokes the SQL/MX compiler to automatically recompile the SQL 
plan. See Similarity Checks and Automatic Recompilation on page 8-8.
Note. DEFINEs are logical names used for SQL/MP objects and cannot be used with SQL/MX 
objects. For SQL/MX objects, use PROTOTYPE host variables.










