mysql:第 1 行的 DELIMITER 语法错误

2022-01-05 00:00:00 mysql phpmyadmin

我尝试在 phpmyadmin/MySQL 中使用以下 SQL 添加此功能

I try to add this function using the following SQL in phpmyadmin/MySQL

DROP FUNCTION IF EXISTS `__myv`;
DELIMITER ;;
CREATE   FUNCTION `__myv`(`a` int, `b` int) RETURNS bigint(20)
BEGIN

    return FLOOR(a / b);
END;;
DELIMITER ;

但我收到此错误:

错误

SQL query:

DELIMITER;

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 1 

如何修复这个错误??

推荐答案

即使 DELIMITER 是一个控制台命令,phpMyAdmin 的导入模块也已经接受了很多年.打开数据库并单击 SQL 时,输入的查询将传递给导入模块,因此它应该可以工作(除非您使用的是非常旧的 phpMyAdmin 版本).

Even if DELIMITER is a console command, phpMyAdmin's import module has accepted it since many years. When opening a database and clicking on SQL, a query entered there is passed to the import module, so it should work (unless you have a very old phpMyAdmin version).

相关文章