SQL/MX Programming Manual for Java

SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java523726-003
4-6
CONTROL Statements
CONTROL Statements
CONTROL statements are SQL/MX compiler directives that affect the execution of
SQL statements in a program and that enable you to override the system-level default
settings for the current process. CONTROL statements include:
CONTROL QUERY DEFAULT, which overrides system-level default settings for the
associated connection context
CONTROL QUERY SHAPE, which forces execution plans by modifying the
operator tree for a prepared statement
CONTROL TABLE, which specifies a performance-related option for DML
accesses to a table or view
For the syntax of CONTROL statements, see the SQL/MX Reference Manual.
ANSI Compliance and Portability
If program portability is important, note that CONTROL statements are SQL/MX
extensions to the ANSI standard.
Static and Dynamic CONTROL Statements
You can code CONTROL statements in an SQLJ program to behave statically or
dynamically. Typically, you code static CONTROL statements in SQLJ clauses:
#sql {CONTROL...};
And code dynamic CONTROL statements in JDBC methods:
statement.ExecuteUpdate("CONTROL...");
However, sometimes the CONTROL statements in SQLJ clauses, as well as other
embedded SQL statements, execute dynamically. For information about why dynamic
execution occurs, see Static and Dynamic SQL on page 4-1.
If you do not customize an SQLJ program, or if customization fails, all the CONTROL
statements execute dynamically through JDBC at run time.
If you successfully customize an SQLJ program, all the CONTROL statements are
statically compiled and their settings are applied to the statically compiled SQL
statements in the module.
If you set -missingSQLObject to false during customization, the CONTROL
statements execute statically and affect only the statically compiled SQL statements
within their line order scope and connection context.
Caution. Do not use a CONTROL QUERY DEFAULT * RESET statement in an SQLJ program
because it turns off an internal default setting needed for application execution.