select-statement

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram>>-+--------------------------------------------------+--------->
   |                      .-,-----------------------. |
   |                      V                         | |
   '-WITH--+-----------+----common-table-expression-+-'
           '-RECURSIVE-'
 
>--fullselect--+-----------------+--+--------------------+------>
               '-order-by-clause-'  '-fetch-first-clause-'
 
   .----------------------.
   V                      | (1) (2)
>----+------------------+-+------------------------------------><
     +-update-clause----+
     +-read-only-clause-+
     +-optimize-clause--+
     '-isolation-clause-'
 
Notes:
  1. The update-clause and read-only-clause cannot both be specified in the same select-statement.
  2. Each clause may be specified only once.

The select-statement is the form of a query that can be directly specified in a DECLARE CURSOR statement, prepared and then referenced in a DECLARE CURSOR statement, or directly specified in an SQLJ assignment clause. It can also be issued interactively causing a result table to be displayed at your work station. In any case, the table specified by a select-statement is the result of the fullselect.

RECURSIVE
Indicates that a common-table-expression is potentially recursive.