MySQL error: 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

Gnanendra picture Gnanendra · Apr 18, 2011 · Viewed 165.6k times · Source

I have the Stored procedure like this:

CREATE PROCEDURE ProG()
  BEGIN
    SELECT * FROM `hs_hr_employee_leave_quota`;
  END

But it gives the 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 3

What does the error mean? What is wrong with line number 2?

Answer

Nicola Cossu picture Nicola Cossu · Apr 18, 2011

You have to change delimiter before using triggers, stored procedures and so on.

delimiter //
create procedure ProG() 
begin 
SELECT * FROM hs_hr_employee_leave_quota;
end;//
delimiter ;