Azad Salam
Azad Salam

Reputation: 146

MySQL - Delimiter error

I have the following procedure

DELIMITER $$

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

The procedure compiles with error though CALL yesterday(); generates correct output.

the error is :

#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

I cant find whats going wrong. Please help!

Upvotes: 1

Views: 364

Answers (1)

RolandoMySQLDBA
RolandoMySQLDBA

Reputation: 44343

You need a space after the word DELIMITER

DELIMITER $$ 

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

Upvotes: 1

Related Questions