Here is a brief characteristics of cursor in MYSQL
READ ONLY
NOT SCROLLABLE
ASENSITIVE
In version five of MySQL, you can only fetch from cursors, you cannot update them. That is,cursors are READ ONLY. You cannot have:
FETCH cursor1 INTO variable1;
UPDATE t1 SET column1 = 'value1' WHERE CURRENT OF cursor1;
Cursors are also NOT SCROLLABLE. That is, you can only fetch the next row, you cannot move back and forth in the result set. You cannot have:
FETCH PRIOR cursor1 INTO variable1;
FETCH ABSOLUTE 55 cursor1 INTO variable1;
And you should avoid doing updates on a table while you have a cursor open on the same table, because cursors are ASENSITIVE.
That is, if you don't avoid doing updates, there is no guarantee
what the results will be. I know that they can be different if you use the InnoDB storage engine instead of the MyISAM storage engine.
- Kiran's blog
- 327 reads













Post new comment