SQL/MP Programming Manual for COBOL85

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL85429326-004
6-34
SQL Compiler Messages
Error Conditions
An error condition results from an invalid reference to an SQL object in an SQL
statement. Examples of invalid references are an incorrect column name or an
incompatible data type. If an error occurs, the SQL compiler generates a listing, but it
does not record the program file in the catalog and does not validate it for execution.
You can force an SQL compilation regardless of errors by specifying the SQLCOMP
FORCE option. The FORCE option causes the compiler to record the SQL program file
in the catalog and to validate it for execution even if errors occur. The SQL compiler
also writes the SQL statements with errors to the program file so that the statements
can be automatically recompiled at run time. The FORCE option is sometimes useful
for debugging a program when you are not concerned about executing the SQL
statements that produce errors.
Dynamic SQL statements are not compiled during explicit SQL compilation. Any errors
in these statements are returned at run time after dynamic compilation by a PREPARE
or EXECUTE IMMEDIATE statement.
Warning Conditions
A warning condition usually occurs when the SQL compiler has insufficient information
available. If a warning occurs, the SQL compiler still records the program file in the
catalog, validates the file for execution, and then returns a warning message. This
subsection describes some of the conditions that cause warnings.
In these two situations, the SQL compiler issues a warning message but still compiles
the statement:
Compiler assumption. The SQL compiler made an assumption necessary to
complete the compilation. For example, if the number of columns in the SELECT
statement does not match the number of host variables, the compiler returns a
warning message and assumes that you do not want to use either the extra
columns or the extra host variables.
Unavailable statistics. The SQL compiler does not have the necessary statistics for
a table or view to optimize an execution plan. The compiler then uses statistics in
the catalog to determine an optimized execution plan.
In other situations, the SQL compiler marks the statement as having insufficient
information to compile and does not record dependencies in the USAGES catalog
tables for the affected statement. The SQL executor then tries to resolve the problem
at run time by automatically recompiling the statement.
At run time, the uncompiled statement causes an error in these cases:
Insufficient information. The SQL compiler does not have enough information to
determine the validity of a statement. For example, an SQL statement refers to a
unavailable table. The table might not exist, or it might reside on an unavailable
remote node. (This situation always occurs for a program that both creates and