在MYSQL Workbench中声明语法错误

时间:2022-05-25 01:49:57

How can I declare and set a variable in my MYSQL WORKBENCH in a stored procedure?

如何在存储过程中的MYSQL WORKBENCH中声明和设置变量?

It gives a syntax error like unexpected Declare_sym at the first line with a cross sign.

它在第一行带有交叉符号的语法错误,如意外的Declare_sym。

I am using the following code for it:

我正在使用以下代码:

Declare StartDate datetime

set StartDate = '2013-07-01';

1 个解决方案

#1


11  

After some googling, I got my answer.

经过一些谷歌搜索,我得到了答案。

A Declare statement must be in between Begin and End statement. Additionally, it must be the first statement after the Begin statement.

Declare语句必须位于Begin和End语句之间。此外,它必须是Begin语句后的第一个语句。

I got the answer from this wonderful site.

我从这个精彩的网站得到了答案。

#1


11  

After some googling, I got my answer.

经过一些谷歌搜索,我得到了答案。

A Declare statement must be in between Begin and End statement. Additionally, it must be the first statement after the Begin statement.

Declare语句必须位于Begin和End语句之间。此外,它必须是Begin语句后的第一个语句。

I got the answer from this wonderful site.

我从这个精彩的网站得到了答案。