简体   繁体   中英

Cannot create stored procedure mysql syntax error

I'm experiencing a serious headache while trying to create a stored procedure.

DELIMITER $$
create PROCEDURE insertDummyUser(rank int unsigned)

BEGIN
INSERT INTO tbl (name, rank) VALUES ('DummyUser', rank);
END$$

It gives me the following error:

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 '' at line 5

I just cant wrap my head around this. It looks fine to me.

I'm just starting out with these stored procedures, so any help at all is greatly appreciated :)

The following stored procedure runs smoothly:

DELIMITER $$

CREATE PROCEDURE `insertDummyUser`(`p_rank` INT UNSIGNED)
BEGIN
  INSERT INTO `tbl` (`name`, `rank`) VALUES ('DummyUser', `p_rank`);
END$$

DELIMITER ;

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM