What you want to do is use the
@@ROWCOUNT
variable after each statement and put that number into a variable. Then output that variable from your stored procedure. This Stack Overflow question will help out a bit:
http://stackoverflow.com/questions/1103260/return-number-of-rows-affected-by-update-statements[
^]
Edit
Sorry, I misread the question as being SQL. For MySQL, the concept is the same, but you use the
ROW_COUNT()
construct instead of
@@ROWCOUNT
(at least for modification statements like you are doing). If you wanted to capture rows from a SELECT, use the
FOUND_ROWS()
construct.