帮忙看下mys存储过程,未能正确执行

ideasky 2017-06-02 08:35:00
存储过程比较复杂内部又调用了几个存储过程,太长,贴个部分代码。

if $site_id>0 then

if $site_type='mobile' then
CALL `init_site`($user_id, $site_id, $order_product_id);
#show warnings;
elseif $site_type='pc' then
CALL `init_pc_site`($user_id, $site_id, $order_product_id);
#show warnings;
elseif $site_type='site' then
CALL `init_site`($user_id, $site_id, $order_product_id);
CALL `init_pc_site`($user_id, $site_id, $order_product_id);


end if;
end if;


当$site_type='site' 这个条件时,只能执行第一个存储过程 CALL `init_site`($user_id, $site_id, $order_product_id);
调换位置,也是执行第一个
elseif $site_type='site' then
CALL `init_pc_site`($user_id, $site_id, $order_product_id);
CALL `init_site`($user_id, $site_id, $order_product_id);

这是何故?

...全文
169 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ideasky 2017-06-04
  • 打赏
  • 举报
回复
抱歉,没说清楚。用个简单代码说明下: if x=1 then call a1(); elseif x=2 then call b1(); elseif x=3 then call a1(); call b1(); end if; 我的问题是,如果这样的语法没问题,当elseif x=3 为什么执行了call a1(),没有call b1()呢?
ACMAIN_CHM 2017-06-04
  • 打赏
  • 举报
回复
没看懂楼主表述的是什么问题。 建议详细说明。
ideasky 2017-06-03
  • 打赏
  • 举报
回复
这个问题,谁知道,顶下

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧