Selecting more than one element

A select cursor that includes a SELECT statement with the collection-derived table clause allows you to select many elements from a collection variable.

About this task

To select elements, follow these steps:

Procedure

  1. Create a client collection variable in your Informix® ESQL/C program.
  2. Declare the select cursor for the collection variable with the DECLARE statement and open this cursor with the OPEN statement.
  3. Fetch the element or elements from the collection variable with the FETCH statement and the INTO clause.
  4. If necessary, perform any updates or deletes on the fetched data and save the modified collection variable in the collection column.

    For more information, see Operate on a collection column.

  5. Close the select cursor with the CLOSE statement, and if you no longer need the cursor, free it with the FREE statement.