SQL Supplement for H-Series RVUs
SQL/MP Programming Manual for COBOL
HP NonStop SQL Supplement for H-Series RVUs—529446-005
1-48
Running the SQL Compiler
Using Current Statistics
For the SQL compiler to generate the best execution plan, it must have current
statistics for the referenced tables. SQL/MP does not automatically update these
statistics. A program must execute the UPDATE STATISTICS statement to generate
current statistics in a catalog.
To execute the UPDATE STATISTICS statement, the process started by the program
must:
•
Have read access to the table
•
Have write access to the catalogs that contain the table descriptions
•
Be the local owner of the table or a remote owner with purge access to the table
(or be the local super ID user)
For information about process access, see “Required Access Authority” in Section 7,
“Program Execution,” of the SQL/MP Programming Manual for COBOL.
In these examples, the first statement updates the statistics for all columns in the
ORDERS table. The second statement updates the statistics columns in the primary
key or clustering key or in any indexes for the table ODETAIL.
EXEC SQL UPDATE ALL STATISTICS FOR TABLE =ORDERS END-EXEC.
EXEC SQL UPDATE STATISTICS FOR TABLE =ODETAIL END-EXEC.
For more information about the UPDATE STATISTICS statement, see the SQL/MP
Reference Manual.
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.










