A QUERY statement specifies a result table that can be ordered (see
result table name). There are four different ways of formulating a QUERY statement.Syntax
<query statement> ::= <declare cursor statement> | <recursive declare cursor statement>
| <named select statement> | <select statement>
Explanation
A QUERY statement generates a
named/unnamed result table.A distinction is made between the following QUERY statements:
Basic types of QUERY statement |
|
DECLARE CURSOR statement |
A named result table is defined. The table is generated with an OPEN CURSOR statement. |
Recursive DECLARE CURSOR statement |
This statement can be used to generate bills of material. |
SELECT statement ( named select statement ) |
A named result table is defined and generated. |
SELECT statement ( select statement ) |
An unnamed result table is defined and generated. |
The SELECT statement (
named select statement ) and SELECT statement ( select statement ) are subject to the rules that were specified for the DECLARE CURSOR statement and those that were specified for the OPEN CURSOR statement.The order of rows in the result table depends on the internal search strategies of the system and is arbitrary. The only reliable me
ans of sorting the result rows is to specify an ORDER clause.Updateable result table
A result table or the underlying base tables are
updateable if the query statement satisfies the following conditions: