例如,当我在 mysql 中尝试嵌套 if 时:(为了清晰起见,简化了代码)
if a = b
then
set i = 1;
if c = d
then
set j = k;
set x = y;
end if; -- when removed it works
end if;
上面的代码会抛出错误。当我尝试删除注释行时,它起作用了,但似乎 set x = y 全局处于 1 级条件下,即 (a = b),并且不特定于 2 级条件 (c = d)。如何像sql server一样在嵌套if中应用开始-结束边界?
最佳答案
关于mysql - 无法像在 sql server 中一样将开始-结束边界应用于 mysql 中的嵌套 if 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17328687/