MySQL - 分隔符错误

时间:2012-03-23 16:52:56

标签: mysql delimiter

我有以下程序

DELIMITER $$

CREATE PROCEDURE yesterday()
BEGIN
SELECT CURDATE()-INTERVAL 1 DAY;
END $$
DELIMITER;

虽然CALL yesterday();生成了正确的输出,但该过程会编译错误。

错误是:

#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

我找不到什么问题。 请帮忙!

1 个答案:

答案 0 :(得分:1)

DELIMITER

一词之后需要一个空格
DELIMITER $$ 

CREATE PROCEDURE yesterday() 
BEGIN 
SELECT CURDATE()-INTERVAL 1 DAY; 
END $$ 
DELIMITER ;