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 COBOL523627-004
8-5
Precedence of Object Name Qualification
The SQL/MX compiler uses this name during preprocessing and explicit
compilation of the embedded DML statement. The table or view name defined in
the PROTOTYPE clause must be visible on the system where the compilation is
performed. This table or view name should also be fully qualified so that default
catalog and schema names are not used.
PROTOTYPE host variables enable run-time mappings, which differ from class MAP
DEFINEs for SQL/MP objects. DEFINEs for SQL/MP objects enable both compile and
run-time mappings. Although PROTOTYPE host variables are mapped at run time, this
run-time mapping cannot be used during explicit recompilation of the application using
mxcmp or mxCompileUserModule. The table or view name defined in the
PROTOTYPE clause of the program is used during explicit recompilation. However, if
your application fails a similarity check during execution and has automatic
recompilation turned on, the automatic recompilation uses the host variable value that
you specify at run time.
For examples of PROTOTYPE host variables, see Using PROTOTYPE Host Variables
as Table Names on page 5-17.
OLT Optimization Considerations for DEFINE Names and
PROTOTYPE Host Variables
If you use DEFINE names or PROTOTYPE host variables in a statement that is
optimized for online transaction processing, the resulting plan uses online transaction
(OLT) optimization in these paths only:
PARTITION_ACCESS operator
DP2 operations
An OLT optimized plan does not use OLT optimization in the ROOT operator if you use
DEFINE names or PROTOTYPE host variables in the statement. For information on
OLT optimization, see the SQL/MX Query Guide.
Precedence of Object Name Qualification
If the object names in an SQL statement are unqualified or partially qualified, the
preprocessor determines the qualification—the catalog and schema (or the node,
volume, and subvolume)—of the object names based on these settings in order of
precedence, from highest to lowest:
1. DECLARE, SET, or CONTROL QUERY DEFAULT statements in the embedded
SQL program
2. Default NAMETYPE, CATALOG, SCHEMA, MP_SYSTEM, MP_VOLUME, or
MP_SUBVOLUME specified in the SYSTEM_DEFAULTS table
3. User group (catalog) and user name (schema) of the current user if the nametype
is ANSI (the default) or the default node, volume, and subvolume specified by the
_DEFAULTS DEFINE if the nametype is NSK