call a stored procedure from the DECLARE statement when using cursors in MySQL
问题 I am trying to use a cursor in MySQL to call a stored procedure many times. I want to call it as many times as a value for my_id exists in some temporary table, and iterate through those ids and concatenate the results. Anyway, I'm having trouble with this part of the process: DECLARE curs CURSOR FOR SELECT something FROM somewhere; I don't want to select something from somewhere. I want something like DECLARE curs CURSOR FOR CALL storedproc(@an_id); Can the DECLARE statement be used to call