A cursor is an embedded SQL query that returns multiple rows. The cursor identifies the current row from a SELECT operation
that returns multiple rows.
When you work with a cursor, you:
- DECLARE the cursor, which identifies it to the program.
- OPEN the cursor, which starts the SELECT process.
- FETCH until not found, which positions the cursor at each row that meets the conditions set in the SELECT statement and INSERTs
the value as designated in the SELECT statement.
- CLOSE the cursor, which ends the SELECT operation and releases any resources that had been assigned to the cursor.