HP NonStop SQL/MP Programming Manual page 139

For c
Table of Contents

Advertisement

Explicit Program Compilation
SQL Compiler Messages
The SQL compiler issues messages for error and warning conditions. An error can
prevent successful compilation of a program file, but a warning does not. For a
description of all SQL compiler messages, see the SQL/MP Messages Manual.
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 directs 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. You can use the FORCE option to debug
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. 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.
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 situations:
HP NonStop SQL/MP Programming Manual for C—429847-008
Running the SQL Compiler in the Guardian
6-23
Environment

Advertisement

Table of Contents
loading

Table of Contents