Data Manipulation with Cursors
Cursors return a series of rows to an embedded application, one row at a time, as the result of a retrieve statement. To use cursors, perform the following steps:
1. Declare a cursor; when you declare a cursor, you assign it a name and associate the cursor with a retrieve statement.
2. Open the cursor.
3. Retrieve columns from the next row. The columns you specified in the declare statement are retrieved into the host variables you specify in the retrieve statement.
4. If required by your application, replace selected columns from the current row with the contents of the host variables you specify, or delete the current row.
5. Close the cursor to terminate processing of the table.
During processing, the row to which the cursor is pointing is referred to as the current row. The cursor is advanced by issuing a cursor retrieve statement. The current row is updated by issuing a cursor replace statement.
Last modified date: 08/14/2024