I fairly new to mysql but have MS SQL experience.
我对mysql很新,但有MS SQL经验。
Is it possible to declare variables and use while statement outside stored procedure?
是否可以声明变量并在存储过程外使用while语句?
I only found examples where guys doing like this
我只找到了男人这样做的例子
1. procedure created
2. execute proc
3. drop proc
Suggest me the right way
建议我正确的方式
1 个解决方案
#1
10
No, you cannot do it. You can use these statements only inside BEGIN...END clause.
不,你不能这样做。您只能在BEGIN ... END子句中使用这些语句。
So, it is possible in stored procedures/functions, triggers and events.
因此,它可以存储过程/函数,触发器和事件。
More information here - MySQL Compound-Statement Syntax.
更多信息 - MySQL Compound-Statement语法。
#1
10
No, you cannot do it. You can use these statements only inside BEGIN...END clause.
不,你不能这样做。您只能在BEGIN ... END子句中使用这些语句。
So, it is possible in stored procedures/functions, triggers and events.
因此,它可以存储过程/函数,触发器和事件。
More information here - MySQL Compound-Statement Syntax.
更多信息 - MySQL Compound-Statement语法。