1


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

5
  • 1
    Are you executing the query against MySql directly? or are you using a application connector like jdbc? Commented Feb 21, 2011 at 6:49
  • Try changing your delimiter to some other single character like | instead of $$ Commented Feb 21, 2011 at 6:51
  • i am executing query against MySql directly. i changed delimeter to | insteed of $$, but now also it is giving error.now what to do? please suggest me. Commented Feb 21, 2011 at 7:12
  • i have put "END$$" but it is giving same error. Am i missing somthing? Commented Feb 21, 2011 at 7:28
  • Is there any other code that is missing? Commented Feb 21, 2011 at 7:47

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

@Shooter - Did this help you resolve your issue? In comment you have mentioned saying END$$ gives you same error?
i put DELIMETER $$; on the top and END; $$ DELEMETER; $$ at the end of procedure, now it is working. Thanks -
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.