作者:小编106 | 来源:互联网 | 2023-05-18 21:22
IhavethefollowingstoredprocedurewhereIneedtoinsertasetofdataforthecolumnsCategory,
I have the following stored procedure where I need to insert a set of data for the columns Category, Function & Status. Where category always should be '1' and Function 1 to 80, status always 'ACTIVE'.
我有以下存储过程,我需要为列Category,Function和Status插入一组数据。类别始终应为“1”且功能1至80,状态始终为“活动”。
BEGIN
DECLARE x INT;
SET x = 1;
WHILE x <= 80 DO
insert into functiontocategory (category,`function`,`status`) values ('1',x,'ACTIVE');
SET x = x+1;
END WHILE;
END
But it gives me 160 rows of inserted data, where 2 sets of 1 to 80s instead of one set. what is wrong with my procedure.
但它给了我160行插入数据,其中2组1到80而不是一组。我的手术有什么问题。
1 个解决方案