Start of change

SET CURRENT EXPLAIN MODE

The SET CURRENT EXPLAIN MODE statement assigns a value to the CURRENT EXPLAIN MODE special register.

Invocation

This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.

Authorization

None required.

Syntax

Read syntax diagram
                             .-=-.                      
>>-SET CURRENT EXPLAIN MODE--+---+--+-NO------------+----------><
                                    +-YES-----------+   
                                    +-EXPLAIN-------+   
                                    '-host-variable-'   

Description

This statement replaces the value of the CURRENT EXPLAIN MODE special register with the value of the specified keyword or host variable.
NO
Specifies that no EXPLAIN information is captured. NO is the initial value of the EXPLAIN MODE special register.
YES
Start of changeEnables the EXPLAIN facility and causes EXPLAIN information to be inserted into the EXPLAIN tables for eligible dynamic SQL statements after the statement is prepared and executed. All dynamic SQL statements are compiled and executed normally.End of change
EXPLAIN
Start of changeEnables the EXPLAIN facility and causes EXPLAIN information to be captured for any eligible dynamic SQL statement after the statement is prepared. This setting behaves similarly to YES, however, dynamic statements, except for SET statements, are not executed.End of change
host-variable
host-variable must be a CHAR or VARCHAR value and must be NO, YES, or EXPLAIN. Leading blanks are not allowed. All input values must be uppercase, must be left justified within the host variable, and must be padded on the right with blanks if the length of the value is less than the length of the host variable.

Start of changeFor values YES and EXPLAIN, prepared statements are not saved into the dynamic statement cache.End of change

Examples

Example 1: The following statement sets the CURRENT EXPLAIN MODE special register, so that EXPLAIN information will be captured for any subsequent eligible dynamic SQL statements during execution.
   SET CURRENT EXPLAIN MODE = YES;
End of change