Run-Time Recompilation Errors; Preventing Automatic Recompilations - HP NonStop SQL/MP Programming Manual

For c
Table of Contents

Advertisement

Program Invalidation and Automatic SQL
Recompilation

Run-Time Recompilation Errors

If automatic SQL recompilation is successful, the SQL statement runs. However, if
recompilation fails, the SQL executor returns compilation errors or warnings as follows:
Recompilation of a single statement. The SQL executor returns error information to
the SQLCODE variable and the SQLCA structure (if declared).
Recompilation of an entire program. If an entire program is recompiled, an SQL
statement that causes an error or warning remains uncompiled, and the SQL
executor suppresses the error or warning message. If the SQL executor
subsequently runs the uncompiled statement, the SQL executor tries again to
recompile the statement. If the statement still causes a compilation error or
warning, the SQL executor returns error information to the SQLCODE variable and
the SQLCA structure (if declared).

Preventing Automatic Recompilations

The SQL executor can perform the similarity check for SQL objects to determine if an
invalid execution plan is operable or inoperable. An operable plan is semantically
correct and can execute correctly without SQL recompilation (although the plan might
not be optimal), whereas an inoperable plan must be recompiled to execute correctly.
By performing the similarity check, the SQL executor recompiles only SQL statements
that have inoperable execution plans. It runs other SQL statements using their existing
plans. Executing the similarity check for an SQL statement eliminates unnecessary
recompilations and is much faster than recompiling the statement.
The COMPILE option directs the SQL compiler to perform similarity checks during
explicit SQL compilation to explicitly recompile only statements with inoperable plans.
For more information about the CHECK and COMPILE options, including their syntax,
see
Section 6, Explicit Program
To direct the SQL executor to perform similarity checks for a program at run time,
follow these steps:
1. Explicitly compile the program using the CHECK INOPERABLE PLANS option.
2. Enable the similarity check using DDL statements for each table or protection view
referenced in the program. (NonStop SQL/MP implicitly enables the similarity
check for other SQL objects.)
Note. You cannot use the similarity check for a query that uses parallel execution plans. At run
time, a query that uses parallel execution plans fails the similarity check, and the SQL
statement containing the query must be automatically recompiled before it can run (if
NORECOMPILE is not specified). To use the similarity check in this query, you must disable
parallel execution using a CONTROL QUERY PARALLEL EXECUTION OFF directive.
HP NonStop SQL/MP Programming Manual for C—429847-008
Compilation.
8-9
Run-Time Recompilation Errors

Advertisement

Table of Contents
loading

Table of Contents