views:

170

answers:

1

Hi,

I'm trying to learn how to use MySQL stored procedures. MySQL accepted my procedure:

CREATE PROCEDURE SimpleProc()
   BEGIN
   SELECT *  FROM myTable;
   END

(In phpMyAdmin, I set // for delimiter. The real version has the name of an actual table instead of myTable.).

But, when I call the procedure with CALL SimpleProc();, I get error "#1312 - PROCEDURE mydb.SimpleProc can't return a result set in the given context".

I read that some versions of php or phpMyAdmin won't work with stored procedures.

I'm using a localhost running on a Mac with MAMP 1.9. I've got MySQL 5.1.44, PHP 5.2.13 & 5.3.2, phpMyAdmin 3.2.5. Does anyone know if stored procedures will work with my set-up? Am I doing something incorrectly? Any advice?

Shout out to the Big Red for a triple overtime victory in Lax.

Thanks, Laxmidi

+1  A: 

Yes, there seems to be a bug in some older versions of phpMyAdmin, which can cause the 1312 error you are getting. This can happen when calling stored procedures that contain SELECT statements from phpMyAdmin.

You may want to check out the following posts for further reading:

This bug effects only phpMyAdmin, and you would still be able to call the stored procedure from anywhere else.

Daniel Vassallo
Hey Daniel,Thank you for the interesting info. It looks like other folks running roughly my setup had the same problems.Now, I have to figure out how to call a mysql stored procedure from php.Again, thanks for the very useful info. -Laxmidi
Laxmidi