DB2 10.5 for Linux, UNIX, and Windows

SET COMPILATION ENVIRONMENT statement

The SET COMPILATION ENVIRONMENT statement changes the current compilation environment in the connection to match the values contained in the compilation environment provided by an event monitor.

This statement changes the values of one or more special registers; these changes, in turn, will affect the compilation of any subsequent dynamic SQL statement.

This statement is not under transaction control.

Invocation

The statement can be embedded in an application program. It is an executable statement that can be dynamically prepared.

Authorization

None required.

Syntax

Read syntax diagramSkip visual syntax diagram
                                 .-=-.                  
>>-SET--COMPILATION ENVIRONMENT--+---+--host-variable----------><

Description

host-variable
A variable of type BLOB containing a compilation environment provided by an event monitor. It cannot be set to null. If host-variable has an associated indicator variable, the value of that indicator variable must not indicate a null value (SQLSTATE 42815). If the format of the compilation environment is incorrect, an error is returned, and the connection settings remain unmodified (SQLSTATE 51040).

Notes

Example

Set the current session's compilation environment to the values contained in a compilation environment that was previously captured by a deadlock event monitor. A deadlock event monitor that is created specifying the WITH DETAILS HISTORY option will capture the compilation environment for dynamic SQL statements. This captured environment is what is accepted as input to the statement.
   SET COMPILATION ENVIRONMENT = :hv1