|
Ispirer SQLWays Database Migration Software
Cursors
The set of rows returned by a query is called the result set. The result set can consist of zero, one, or multiple rows, depending on how many rows meet your search criteria.
For queries that return more than one row, you must declare a cursor to process the rows. A cursor points to the current row in the result set of a multi-row query.
You can use the following commands to control a cursor: OPEN, FETCH, and CLOSE. First, you initialize the cursor with the OPEN statement, which identifies the result set. Then, you can execute FETCH repeatedly until all rows have been retrieved. When the last row has been processed, you release the cursor with the CLOSE statement. You can process several queries in parallel by declaring and opening multiple cursors.