Complex trigger WHEN clause access (QBLOCKTYPE='TRIGGR')

The plan table does not report simple trigger WHEN clauses, such as WHEN (N.C1 < 5). However, the plan table does report complex trigger WHEN clauses, which are clauses that involve other base tables and transition tables.

Begin program-specific programming interface information. The QBLOCK_TYPE column of the top level query block shows TRIGGR to indicate a complex trigger WHEN clause.

Consider the following trigger:

CREATE TRIGGER REORDER                                                
       AFTER UPDATE OF ON_HAND, MAX_STOCKED ON PARTS                 
       REFERENCING NEW TABLE AS NT OLD AS O                              
       FOR EACH STATEMENT MODE DB2SQL                                    
       WHEN (O.ON_HAND < (SELECT MAX(ON_HAND) FROM NT))                  
          BEGIN ATOMIC                                                   
              INSERT INTO ORDER_LOG VALUES (O.PARTNO, O.ON_HAND);        
          END                              

The following table shows the corresponding plan table for the WHEN clause.

Table 1. Plan table for the WHEN clause
QBLOCKNO PLANNO TABLE ACCESSTYPE QBLOCK_TYPE PARENT_QBLOCKNO
1 1     TRIGGR 0
2 1 NT R NCOSUB 1

End program-specific programming interface information.