ROWNO Predicate (rowno_predicate)
The ROWNO
predicate restricts the number of lines in a result table (see result table name).Syntax
<rowno_predicate> ::= ROWNO < <unsigned_integer>
| ROWNO < <parameter_spec>
| ROWNO <= <unsigned_integer>
| ROWNO <= <parameter_spec>
Explanation
A ROWNO predicate may only be used in a
WHERE clause that belongs to a QUERY statement. The ROWNO predicate can be used like any other predicate in the WHERE clause if the following restrictions are observed:You can specify the maximum number of lines in the result table using an unsigned integer or a parameter specification. If more lines are found, they are simply ignored and do not lead to an error message. Specifying a ROWNO predicate of the type ROWNO <= 0 results in an empty results table.
If a ROWNO predicate and an
ORDER clause are specified, only the first n result lines are searched and sorted. The result usually differs from that which would have been obtained if a ROWNO predicate had not been used and if the first n result rows had been considered.If a ROWNO predicate and a
set function are specified, the set function is only applied to the number of lines restricted by the ROWNO predicate.