Mark
Mark

Reputation: 3123

MYSQL syntax error, unexpected IDENT_QUOTED, expecting $end

I am trying to chain multiple operations on my database for a change repo for ease of database consistancy between development/production environments. I have created a file with multiple commands and am getting this weird error that I can't seem to find a reference on.

A snippet is below:

deallocate prepare stmt;

END$$

drop procedure if exists SearchByWantListCount;

delimiter $$

CREATE DEFINER=`webaccess`@`%` PROCEDURE `SearchByWantListCount`(
    IN loggedInUser INT,
    IN filter varchar(255))
BEGIN

The delimiter is being underlined in red and I'm getting the error:

syntax error, unexpected IDENT_QUOTED, expecting $end

Upvotes: 2

Views: 5274

Answers (2)

Maxime Oudot
Maxime Oudot

Reputation: 155

That's because you don't need to put delimiter before $$ when you want to use the delimiter. Simply put $$.

The syntax you used defines the delimiter, thing that has been done earlier (since we can see you use the delimiter on the END).

Why "delimiter ;" worked is because the semi-colon at the end of "drop procedure if exists SearchByWantListCount;" is then counted as a delimiter. Would you put "delimiter $$" here or not, you need a $$ between the drop line and the start of your next procedure (SearchByWantListCount), or before "delimiter $$" if you want to redefine it.

By the way, you don't need your "delimiter ;" since you put $$ after the previous END symbol. Simply remove the "delimiter" before the $$.

Upvotes: 1

Mark
Mark

Reputation: 3123

I added in a

delimiter ;
drop procedure if exists SearchByWantListCount;

which seemed to make everything happy....

Upvotes: 2

Related Questions