创建存储过程时遇到问题

发布于 2024-09-01 15:39:22 字数 363 浏览 0 评论 0原文

我第一次摆弄存储过程,但甚至无法创建一个简单的选择!我正在使用 phpMyAdmin,这是我的 SQL:

DELIMITER // 
CREATE PROCEDURE test_select() 
BEGIN 
SELECT * FROM products LIMIT 10; 
END // 
DELIMITER ;

提交后,我的本地主机思考了很长一段时间,最终加载了一个没有内容的页面,名为 /phpmyadmin/import.php。重新加载 phpMyAdmin 并尝试调用该过程后:

CALL test_select();

我收到“过程不存在”错误。有什么想法吗?

I'm messing around with stored procedures for the first time, but can't even create a simple select! I'm using phpMyAdmin and this is my SQL:

DELIMITER // 
CREATE PROCEDURE test_select() 
BEGIN 
SELECT * FROM products LIMIT 10; 
END // 
DELIMITER ;

After submitting that, my localhost does some thinking for a loooong time and eventually loads a page with no content called /phpmyadmin/import.php. After reloading phpMyAdmin and trying to invoke the procedure:

CALL test_select();

I get a "PROCEDURE doesn't exist" error. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绮筵 2024-09-08 15:39:22

尝试使用phpMyAdmin的分隔符字段,如下图所示:

创建存储过程时遇到问题

只需在查询窗口中输入以下内容即可:

CREATE PROCEDURE test_select() 
BEGIN 
    SELECT * FROM products LIMIT 10; 
END

另外请注意,某些旧版本的 phpMyAdmin 中存在错误,当您从 phpMyAdmin 调用包含 SELECT 语句的存储过程时,可能会导致错误。

您可能需要查看以下帖子以进一步阅读:

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

Try to use the delimiter field of phpMyAdmin, as shown in the screenshot below:

Trouble creating stored procedure

Simply put the following in the query window:

CREATE PROCEDURE test_select() 
BEGIN 
    SELECT * FROM products LIMIT 10; 
END

In addition note that there is bug in some older versions of phpMyAdmin, which can cause an error when you call 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文