在 MYSQL 中使用定界符
Using Delimiter in MYSQL
我必须在 Mysql 中使用 delimiter
来创建过程吗?
是的,您必须 - 除非您的程序由单个语句组成。这是 well explained in the documentation:
Each stored program contains a body that consists of an SQL statement. This statement may be a compound statement made up of several statements separated by semicolon (;
) characters.
[...]
If you use the mysql client program to define a stored program containing semicolon characters, a problem arises. By default, mysql itself recognizes the semicolon as a statement delimiter, so you must redefine the delimiter temporarily to cause mysql to pass the entire stored program definition to the server.
To redefine the mysql delimiter, use the delimiter
command. [...] This enables the ;
delimiter used in the procedure body to be passed through to the server rather than being interpreted by mysql itself.
是的,在查询选项卡或 mysqlclient 中您需要它们,如所述here
问题是分号是命令的结尾,但在存储过程中所有分号都是存储过程的一部分。
Mysql 现在他必须通过更改 DELIMITER 来解释分号作为过程的一部分
我必须在 Mysql 中使用 delimiter
来创建过程吗?
是的,您必须 - 除非您的程序由单个语句组成。这是 well explained in the documentation:
Each stored program contains a body that consists of an SQL statement. This statement may be a compound statement made up of several statements separated by semicolon (
;
) characters.[...]
If you use the mysql client program to define a stored program containing semicolon characters, a problem arises. By default, mysql itself recognizes the semicolon as a statement delimiter, so you must redefine the delimiter temporarily to cause mysql to pass the entire stored program definition to the server.
To redefine the mysql delimiter, use the
delimiter
command. [...] This enables the;
delimiter used in the procedure body to be passed through to the server rather than being interpreted by mysql itself.
是的,在查询选项卡或 mysqlclient 中您需要它们,如所述here
问题是分号是命令的结尾,但在存储过程中所有分号都是存储过程的一部分。
Mysql 现在他必须通过更改 DELIMITER 来解释分号作为过程的一部分