DROP PROCEDURE IF EXISTS stat_cube.sp_test;
CREATE PROCEDURE stat_cube.`sp_test`( )
BEGIN
declare dt1,dt2 date default '2011-04-01';
select dt1,dt2;
select day_id into dt1 from stat_cube.dim_dt where 1<>1;
set dt2 = (select day_id from stat_cube.dim_dt where 1<>1);
select dt1,dt2;
END;
call stat_cube.sp_test();
CREATE PROCEDURE stat_cube.`sp_test`( )
BEGIN
declare dt1,dt2 date default '2011-04-01';
select dt1,dt2;
select day_id into dt1 from stat_cube.dim_dt where 1<>1;
set dt2 = (select day_id from stat_cube.dim_dt where 1<>1);
select dt1,dt2;
END;
call stat_cube.sp_test();
结果 select into 之后的dt1没有值没有变化,还是‘2011-04-01’,而dt2的值变为null。