can i use i stored procedure in a cursor? Something like this:

SET cCheckId = '<K10>'; SET nCheckErrors = 0;
BEGIN
DECLARE curK10 INSENSITIVE CURSOR FOR
call dba.applsp_getcolumnsfortable('test') FOR READ ONLY;
OPEN curK10;
LoopK10: LOOP
FETCH NEXT curK10 INTO cColumn;
IF sqlstate = err_notfound THEN
LEAVE LoopK10
END IF;
SET nCheckErrors = nCheckErrors + 1;
SET cMsg = 'Foreign key [' + cColumn + '] komt meer dan 1 keer voor.';
SET nMsgId = nMsgId + 1; INSERT INTO _ishdbcheck VALUES(nMsgId, cCheckId, cMsg);
END LOOP LoopK10;
CLOSE curK10;
SET nMsgId = nMsgId + 1; INSERT INTO _ishdbcheck VALUES(nMsgId, cCheckId, RIGHT(STR(nCheckErrors),5) + ' fout(en).');
SET nMsgId = nMsgId + 1; INSERT INTO _ishdbcheck VALUES(nMsgId, cCode, cSepLine);
SET nTotalErrors = nTotalErrors + nCheckErrors;
END;

Do not look at the nondeclared variables.