为什么使用简单的存储过程时会出现MySQL错误#1312? [英] Why Am I Getting MySQL Error #1312 when Using a Simple Stored Procedure?

查看:98
本文介绍了为什么使用简单的存储过程时会出现MySQL错误#1312?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习如何使用MySQL存储过程. MySQL接受了我的程序:

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

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

(在phpMyAdmin中,我为分隔符设置了//.真实版本使用的是实际表的名称,而不是myTable的名称.)

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

但是,当我用CALL SimpleProc();调用过程时,出现错误#1312-PROCEDURE mydb.SimpleProc无法在给定上下文中返回结果集".

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".

我了解到某些版本的php或phpMyAdmin无法与存储过程一起使用.

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

我正在使用在MAMP 1.9的Mac上运行的本地主机.我有MySQL 5.1.44,PHP 5.2.13& 5.3.2,phpMyAdmin 3.2.5.有谁知道存储过程是否适用于我的设置?我做错了什么吗?有什么建议吗?

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?

向大红色大喊,以争取在Lax中获得三倍加时赛胜利.

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

谢谢, 拉克西米(Laxmidi)

Thanks, Laxmidi

推荐答案

是的,某些较旧版本的phpMyAdmin中似乎存在一个错误,该错误可能导致您收到1312错误.当从phpMyAdmin调用包含SELECT语句的存储过程时,可能会发生这种情况.

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:

  • MySQL Stored Procedures not working with SELECT (basic question)
  • How do I write an SP in phpMyAdmin (MySQL)? (comments)

此错误仅影响phpMyAdmin,您仍然可以从其他任何地方调用存储过程.

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

这篇关于为什么使用简单的存储过程时会出现MySQL错误#1312?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆