Yugal
Yugal

Reputation: 1665

how to solve syntax error in procedure in mysql?


i am executing a procedure in mysql, procedure is-

delimiter $$
create procedure getFacility (in id int, out MyFacility VARCHAR(200))
begin
    select Facility into MyFacility 
        from facilities 
        where FacilityID = id ;
end $$
delimiter ;

and it is giving error below-

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 'end $$
delimiter' at line 1
(0 ms taken)

how to solve this error?

Thanks,
Yugal

Upvotes: 1

Views: 516

Answers (2)

Adam Morgan
Adam Morgan

Reputation: 495

i had the same issue... my solution was to just remove the delimiter operator call on line one, and remove the delimiter after 'END'... it seems JDBC just doesn't like that operator.

it would also be really nice if MYSQL gave some more precision on syntax errors.

Upvotes: 1

Sachin Shanbhag
Sachin Shanbhag

Reputation: 55489

I think the error is because of the space between END and $$. Try END$$ and it should compile properly.

http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

Upvotes: 1

Related Questions