Was this helpful?
Cursor Select
The cursor SELECT statement is specified as part of a DECLARE CURSOR statement. Within the DECLARE CURSOR statement, the SELECT statement is not preceded by EXEC SQL. The cursor SELECT statement specifies the data to be retrieved by the cursor. When executed, the DECLARE CURSOR statement does not perform the retrieval; the retrieval occurs when the cursor is opened.
If the cursor is declared FOR UPDATE, the select cannot see more than one table, cannot see a view and cannot include a GROUP BY, HAVING, ORDER BY, or UNION clause.
The cursor select can return multiple rows, because the cursor provides the means to process and update retrieved rows one at a time. The correlation of expressions to host language variables takes place with the FETCH statement, so the cursor select does not include an INTO clause. The rules for the remaining clauses are the same as in the non-cursor select.
For more information, see Data Manipulation with Cursors.
Last modified date: 08/28/2024