小弟在存储过程中需要能进行多层判断,类假下面的写法
case when v_iTempflag = 1 then
if v_iTempBalance - v_iTempcurpos >=0 then
-- 处理语句 ...(略)
elseif v_iTempBalance - v_iTempcurpos <0 then
-- 处理语句 ...(略)
end if;
when v_iTempflag = 2 then
if v_iTempBalance - v_iTempcurpos >=0 then
-- 处理语句 ...(略)
elseif v_iTempBalance - v_iTempcurpos <0 then
-- 处理语句 ...(略)
end if;
else -- 处理语句 ...(略)
end;老是在第一个END IF;之后的WHEN这里报错“Incorrect syntax near 'WHEN'”,请教一下高手们这到底是什么原因?如果不能这样写,最优的解决方案是什么,谢谢!
case when v_iTempflag = 1 then
if v_iTempBalance - v_iTempcurpos >=0 then
-- 处理语句 ...(略)
elseif v_iTempBalance - v_iTempcurpos <0 then
-- 处理语句 ...(略)
end if;
when v_iTempflag = 2 then
if v_iTempBalance - v_iTempcurpos >=0 then
-- 处理语句 ...(略)
elseif v_iTempBalance - v_iTempcurpos <0 then
-- 处理语句 ...(略)
end if;
else -- 处理语句 ...(略)
end;老是在第一个END IF;之后的WHEN这里报错“Incorrect syntax near 'WHEN'”,请教一下高手们这到底是什么原因?如果不能这样写,最优的解决方案是什么,谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货