I'm writing a function in sql.
BEGIN
declare len int default 0;
declare other variables;
declare myCursor cursor for *myquery*;
set len = ? // cursor's length
RETURN -1;
END
I need the number of rows in the cursor's result, because the continuance of the function depends on the length.
I've tried @@CURSOR_ROWS, but it gave me: "MySQL said: #1193 - Unknown system variable 'CURSOR_ROWS'"
can anyone help me?
The answer is:
select FOUND_ROWS() into len;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With