下面我已经设置了一个将使用参数循环的过程。然而,我正在测试它的一部分,但得到了不想要的输出。MySQL空变量不返回正确的情况下
当我选择p_start为空时,选择v_start输出将状态为v_start为NULL。但我认为有一个case语句会将v_start重新定义为1而不是...
有什么建议吗?谢谢。
Create procedure counter_loop(p_start int,
p_end int,
p_step int,
p_delim varchar(5))
begin
declare v_start int ;
declare v_end int ;
declare v_step int ;
declare v_sign int;
-- check p_start
case p_start
when null then
set v_start := 1;
else
set v_start := p_start;
end case;
select v_start;
当我调用counter_loop(null,10,2,'abc')时,我得到p_start为空。但我想它出来作为1.如果我使用长度比较的过程,这有帮助吗?我的意思是长度(空)是空的,不是正面的... – user1682055