Entering content frame

SINGLE SELECT statement 

A SINGLE SELECT statement specifies a result table with one row (see result table name) and assigns the values in this row to parameters.

Syntax

<single_select_statement> ::=
SELECT [<distinct_spec>] <select_column>,...
INTO <parameter_spec>,... FROM <from_table_spec>,...
[<where_clause>] [<group_clause>] [<having_clause>] [<lock_option>]

distinct_spec, select_column, parameter_spec, from_table_spec, where_clause, group_clause, having_clause, lock_option

Explanation

The number of rows in the result table must not be greater than one. If the result table is empty or contains more than one row, corresponding messages or error codes are issued and no values are assigned to the parameters specified in the parameter specifications. The return code 100 – row not found - is set if the result table is empty.

If the result table contains just one row, the values of this row are assigned to the corresponding parameters. The FETCH statement rules apply for assigning the values to the parameters.

The order of the GROUP and HAVING clauses is random.

A LONG column can only be specified in a selected column in the uppermost sequence of selected columns in a single select statement if the DISTINCT specification DISTINCT was not used there.

Leaving content frame