创建存储过程时遇到问题
我第一次摆弄存储过程,但甚至无法创建一个简单的选择!我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用phpMyAdmin的分隔符字段,如下图所示:
只需在查询窗口中输入以下内容即可:
另外请注意,某些旧版本的 phpMyAdmin 中存在错误,当您从 phpMyAdmin 调用包含 SELECT 语句的存储过程时,可能会导致错误。
您可能需要查看以下帖子以进一步阅读:
此错误仅影响 phpMyAdmin,您仍然可以从其他任何地方调用存储过程。
Try to use the delimiter field of phpMyAdmin, as shown in the screenshot below:
Simply put the following in the query window:
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.