SQL/MP Installation and Management Guide
Managing Database Applications
HP NonStop SQL/MP Installation and Management Guide—523353-004
10-23
Using the COMPILE Option
Using the COMPILE Option 
The COMPILE option influences the behavior of the SQL compiler. The option 
determines which SQL statements are compiled during an explicit SQL compilation. 
You can direct the SQL compiler to use the similarity check to determine if a 
statement’s execution plan from a previous compilation is operable. The SQL compiler 
then recompiles only the statements that fail the similarity check; the other SQL 
statements retain their existing plans. 
The COMPILE option has three forms:
•
COMPILE PROGRAM directs the SQL compiler to explicitly compile all SQL 
statements in the program. COMPILE PROGRAM is the default. 
If you include the STORE SIMILARITY INFO clause, the SQL compiler stores 
similarity information for each SQL statement in the program file.
SQLCOMP 
Option Behavior 
CHECK INOPERABLE PLANS Option (continued)
RECOMPILE 
(continued)
For an invalid dynamic SQL statement, the SQL executor performs the 
similarity check as follows: 
•
If the similarity check passes, the SQL executor executes the 
statement without recompilation. 
•
If the similarity check fails, the SQL executor recompiles (in 
memory) and executes the statement using Guardian names and 
DEFINE names as follows:
Uses names at prepare time if execution-time name resolution is 
not enabled
Uses names at statement execution time if execution-time name 
resolution is enabled 
NORECOMPILE  The SQL executor performs the similarity check for the invalid SQL 
statement as follows: 
•
If the similarity check passes, the SQL executor executes the 
statement without recompilation. 
•
If the similarity check fails, the behavior depends on the type of 
statement: 
•
For a static SQL statement, the SQL executor returns an error to 
the program because of the NORECOMPILE option. 
•
For a dynamic SQL statement, the SQL executor recompiles the 
statement because the NORECOMPILE option has no effect on 
dynamic SQL statements. Invalid dynamic plans are always 
recompiled. 
Table 10-2. Behavior of the SQL Executor for an Invalid Statement Detected After 
Load Time (page 2 of 2)










