下面我已經設置了一個將使用參數循環的過程。然而,我正在測試它的一部分,但得到了不想要的輸出。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