Last answered:

26 Feb 2023

Posted on:

16 Feb 2023

0

Problem getting stored procedure to work

Hello, I'm unable to create the stored procedure. I have: SQL Error [1064] [42000]: 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 7. 

2 answers ( 0 marked as helpful)
Instructor
Posted on:

17 Feb 2023

0

Hi Michelle!
Thanks for reaching out!


Could you please support your question with the entire code you’ve executed, as well as a screenshot containing the entire error message you’ve encountered? This can help us assist you better. Thank you.


Looking forward to your answer.
Best,
Tsvetelin

Posted on:

26 Feb 2023

0

# stored procedure to return the first 1000 rows from the 'employees' table:

use employees;

-- drop procedure if exists select_employees;

 

delimiter $$

create procedure select_employees()

begin

select * from employees

limit 1000;

END $$

 

delimiter ; -- this resets the semi-colon as a delimiter for further coding

 

# call the routine 

call employees.select_employees();

 

call select_employees();

Submit an answer