FIRST clause to select specific rows
You can include a FIRST max specification in the Projection clause of a SELECT statement, where max has an integer value, to instruct the query to return no more than the first max rows that match the conditions of the SELECT statement. You can also use the keyword LIMIT as a synonym for FIRST in this context (and only in this context). The rows that a SELECT statement with a FIRST clause returns might depend on whether the statement also includes an ORDER BY clause.
The keyword SKIP, followed by an unsigned integer, can precede the FIRST or LIMIT keyword in the Projection clause. The SKIP offset clause instructs the database server to exclude the first offset qualifying rows from the result set of the query before returning the number of rows that the FIRST clause specifies. In SPL routines, the parameter of SKIP, FIRST, or LIMIT can be a literal integer or a local SPL variable. If the Projection clause includes SKIP offset but no FIRST or LIMIT specification, then the query returns all of the qualifying rows except for the first offset rows.
- when the SELECT statement is part of a view definition
- in a subquery, except in the FROM clause of the outer query
- in a cross-server distributed query in which a participating database server does not support the SKIP, FIRST, or LIMIT keywords.
For information about restrictions on use of the FIRST clause, see the description of the Projection clause of the SELECT statement in the Informix® Guide to SQL: Syntax.