如何在mysql存储过程中使用foreach数组

mzmfm0qo  于 2021-06-15  发布在  Mysql
关注(0)|答案(0)|浏览(369)

我刚刚学习了mysql存储过程。我尝试创建一个数组,并使用一个循环来处理数组中的每一行,就像php中的foreach一样,但是如何在mysql存储过程中使用它呢

BEGIN

DROP TEMPORARY TABLE IF EXISTS final_late;
CREATE TEMPORARY TABLE final_late(staff_id int, total_late_count int, total_late_time int, month int, year int);

SET @work_staff = 'SELECT * FROM work_staffs WHERE staff_id = p_staff_id';

//example i want
WHILE (@work_staff as item) DO
//How to get row item like foreach in php (in php: item->column)
END WHILE;

END

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题