Thực hiện đếm trước con trỏ:
select count(*)
into @user_cnt
from users
where fullname like concat (
lastname,
' ',
firstname,
' (',
middlename,
'%'
);
CHỈNH SỬA:Nếu bạn muốn làm điều đó sau khi MỞ con trỏ, hãy thử thực hiện:
OPEN your_cursor;
select FOUND_ROWS() into user_cnt ;