Last answered:

02 Dec 2022

Posted on:

02 Dec 2022

0

Resolved: syntax error code 1064 for create procedure

When i copy the code in this lecture:

DELIMITER $$
CREATE PROCEDURE select_employees()
BEGIN

SELECT * FROM employees
LIMIT 1000;

ENDS $$

delimiter ;

It comes up with this error code:

Error Code: 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 7

The error shows up when adding the semicolon after 'LIMIT 1000'

Can you please advise on what may be going wrong?

2 answers ( 2 marked as helpful)
Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

02 Dec 2022

1

Hi Joe,

In your text you have ENDS $$ where it should be END$$

The syntax indicator gets close but sometimes can be a little misleading.

Hope this helps.

Regards,

Kev T.

Instructor
Posted on:

02 Dec 2022

0

Hi Joe!
Thanks for reaching out.

As Kev said it should be END $$ instead of ENDS $$.

Hope this helps.
Best,
Tsvetelin

Submit an answer