is there a way to use dynamic limit in the cursor?
DECLARE cursor_friends CURSOR FOR
SELECT `name` FROM iFriends
LIMIT iLimit, 50;
I have read on some forums that mysql cursors don’t support dynamic limit in cursors. wondering if there is some alternative for this
MySQL cursors cannot use dynamic statements.
Workaround: use prepared statements to create a temporary table or a view with LIMIT clause, then open cursor on this new table or view.
Let me ask you a question – why do you need to use cursor? Sometimes it is possible to avoid using cursors.