FETCH with a Sequential Cursor
A sequential cursor can fetch only the next row in sequence from
the active set. The only option available is the default option, NEXT.
A sequential cursor can read through a table only once each time the
table is opened. The following Informix®
ESQL/C example
illustrates the FETCH statement with a sequential cursor:
EXEC SQL FETCH seq_curs INTO :fname, :lname;
EXEC SQL FETCH NEXT seq_curs INTO :fname, :lname;
When the program opens a sequential cursor, the database server processes the query to the point of locating or constructing the first row of data. The goal of the database server is to tie up as few resources as possible.
Because the sequential cursor can retrieve only the next row, the database server can frequently create the active set one row at a time.
On each FETCH operation, the database server returns the contents of the current row and locates the next row. This one-row-at-a-time strategy is not possible if the database server must create the entire active set to determine which row is the first row (as would be the case if the SELECT statement included an ORDER BY clause).