请查看为什么在我打印变量以及将其插入表中时变量mpsId为空。当我单独运行select语句时,变量MPSId显示,但单独显示不显示
BLOCK1: begin
declare done INT DEFAULT 0;
declare gid BIGINT;
declare activity_name VARCHAR(255) ;
declare duration1 BIGINT;
declare type_1 VARCHAR(255) ;
declare mpsId VARCHAR(50);
declare shop_activity_id BIGINT;
declare start_date1 VARCHAR(100);
declare curs CURSOR for select id, activityName, `duration`, `Type`, shopActivityId, MPSId, date_format(startDate, '%d-%m-%Y') from GanttTask where `Type` = 'Project';
declare continue handler for not found set done :=1;
open curs;
LOOP1: loop
fetch curs into gid, activity_name, duration1, type_1, shop_activity_id, mpsId, start_date1;
if done = 1 then
leave LOOP1;
end if;
select concat('MPS ID is ' ,mpsId);
insert into app_fd_gantt_result (id, c_activityName, c_Type1, c_duration, `c_mpsId`, c_startDate, c_parent) VALUES (gid, activity_name, type_1, duration1, mpsId, start_date1, NULL);
end loop LOOP1;
close curs;
end BLOCK1
在创建存储过程之后,我在最后添加了此变量(我不认为这应该是一个问题)