SINGLE SELECT Statement (single_select_statement)
A SINGLE SELECT
statement (single_select_statement
)
specifies a single-row result table and assigns the values of this result
table 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>]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. If the result table is empty, the
message 100 – Row not found
is displayed.
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 LOB
column can be specified in a selected column select_column
in
the uppermost sequence of selected columns in a SINGLE SELECT
statement
only if the DISTINCT
specification (distinct_spec
) DISTINCT
was not used there.