Result set of SELECT statement in LOOP in MySQL Stored Procedure
CURSORs are rarely worth using.  Try to get rid of them.  In your example:

SELECT b.*
    FROM table2 AS b
    JOIN table1 AS a  ON b.c1 = a.field1
                     AND b.c2 = a.field2


Anyway, when you execute multiple SELECTs inside a Stored Proc, you get "multiple resultsets".  Some interfaces either can't handle such, or need different coding.

And you had an error:  The cursor SELECT fetched 2 columns but the FETCH expected 4.

Coding questions should be addressed to stackoverflow.com