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?
This question is related to
mysql
mysql-error-1064
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 ;
Delimiters, delimiters...
You really need them when there are multiple statements in your procedure. (in other words, do you have a ;
in your code and then more statements/commands? Then, you need to use delimiters).
For such a simpler rpocedure as yours though, you could just do:
CREATE PROCEDURE ProG()
SELECT * FROM `hs_hr_employee_leave_quota`;
How to find out what this MySQL Error is trying to say:
#1064 - You have an error in your SQL syntax;
This error has no clues in it. You have to double check all of these items to see where your mistake is:
!@#$%^&*()-_=+[]{}\|;:'",<>/?
select
, into
, or countless others. Take away as much as you can from the broken query until it starts working. And then use PostgreSQL next time that has a sane syntax reporting system.
MYSQL PROCEDURE steps:
DELIMITER //
create PROCEDURE, you can refer syntax
NOTE: Don't forget to end statement with ' ; '
create procedure ProG() begin SELECT * FROM hs_hr_employee_leave_quota; end;//
delimiter ;
call ProG();
This might be a memmory issue on mysql try to increase max_allowed_packet in my.ini
Source: Stackoverflow.com