It fires when a cursor reaches the end of a data set.
At that point, a No Data condition fires with SQLSTATE value '02000'.
With all the processing power that cursors provide, there is a downside in that large resultsets can be as slow as molasses to process.
As with all database tools, you must carefully consider how cursors meet the needs of your users and determine whether using them within a procedure or function will provide the best solution to the problem you are attempting to solve.
This type of cursor is faster than the previous types because no copying is done.
However, any changes made to the data from another process may affect the data being used by the cursor, leading to unpredictable results.
A cursor is a special kind of loop for traversing through an SQL resultset one row at a time.
END LOOP cursor_loop; CLOSE cursor1; SET done=0; As a best practice, you should always reset your status variable to 0 after the cursor loop terminates; otherwise, subsequent or nested cursor loops may terminate prematurely.Once the cursor is opened, it does not have sensitivity to inserts, updates, or deletions of rows underlying its result table.