Select elements from a collection
Suppose you want your SPL routine to select elements from the collection stored in the collection variable, one at time, so that you can handle the elements.
To move through the elements
of a collection, you first need to declare a cursor using a FOREACH
statement, just as you would declare a cursor to move through a set
of rows. The following figure shows the FOREACH and END FOREACH statements,
with no statements between them yet.
The FOREACH statement is described in The FOREACH loop and the Informix® Guide to SQL: Syntax.
The next topic, The collection query, describes the statements that are omitted between the FOREACH and END FOREACH statements.
The examples in the following sections are based on the polygons table of Manipulate collections..