Enter required infomation below!
DECLARE done BOOLEAN DEFAULT FALSE;
DECLARE ^cursor_variable$ CURSOR FOR ^select_query$;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN ^cursor_variable$;
^cursor_loop_name$: LOOP
FETCH ^cursor_variable$ INTO ^field_names$;
IF done THEN
LEAVE ^cursor_loop_name$;
END IF;
-- cursor loop statements
END LOOP;
CLOSE ^cursor_variable$;
MYSQL Query Output |