1

I have created the following stored procedure using phpmyadmin + mysql version 5.0.77 but not working as expected.....and showing the below error.

Stored Procedure:

delimiter //
create procedure myProc()
begin
  select name from main_contacts;
end //
delimiter;
Error

There seems to be an error in your SQL query. 
The MySQL server error output below, 
if there is any, may also help you in diagnosing the problem

ERROR: 

Unknown Punctuation String @ 11
STR: //
SQL: delimiter //
create procedure myProc()
begin
select name from main_contacts
SQL-query :  

delimiter // create procedure myProc() begin select name from main_contacts 

MySQL said: 


#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 'delimiter //
create procedure myProc()
begin
select name from main_contacts' at line 1
1
  • What mysql version do you use? SELECT VERSION() Commented Jan 11, 2011 at 5:41

2 Answers 2

4

You need to give space after delimiter. SO replace delimiter; with delimiter ; or you can try,

delimiter //
    create procedure myProc()
    begin
      select name from main_contacts;
    end //
    delimiter ;
Sign up to request clarification or add additional context in comments.

2 Comments

The trick is to add the last line: "delimiter ;". If you omit that line it gives you "Unknown Punctuation String" error. I had this in PHPMyAdmin v4.2.5 You can also use another client like MySQL WorkBench which doesn't suffer from this bug(?).
Well after using PHPMyAdmin v4.2.5 I can say it's very buggy. I got errors like "Error", "Unknown Punctuation String" or no error but my procedures/functions were not saved, Just use MySQL WorkBench. Works like a charm.
2

The problem is that your MySQL client doesn't like the DELIMITER command. If you're using an older version of phpMyAdmin, use a new one, since the issue has been resolved in phpMyAdmin. If you can use the MySQL client mysql, that should solve your problem, too.

If you're stuck using an older version of phpMyAdmin, and you can't or don't want to use mysql, check out this advice from Nate Smith on the Nth Design web site...

http://blog.nth-design.com/2009/02/25/creating-sp-in-phpmyadmin/

Hope this helps.

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.