You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在phpMyAdmin中创建带输入参数的MySQL存储过程遇#1064错误求助

Fixing the #1064 Error When Creating a MySQL Stored Procedure in phpMyAdmin

Hey there! That error is super common when building stored procedures in phpMyAdmin—let’s break down what’s going wrong and how to fix it.

The Root Cause

phpMyAdmin uses the semicolon (;) as its default statement delimiter. When you wrote your stored procedure, the SELECT * FROM Toy WHERE Toy_ID = toy_no; line ends with a semicolon. MySQL sees that semicolon and thinks, "Okay, the entire CREATE PROCEDURE command is done here!" Then it tries to parse the remaining END; as a brand-new statement, which doesn’t make any sense—hence the syntax error.

The Fix: Temporarily Change the Delimiter

We need to tell MySQL to use a different delimiter (like //) while we define the stored procedure, then switch back to the semicolon afterward. Here’s the corrected code:

DELIMITER //
CREATE PROCEDURE searchtoy (IN toy_no INT)
BEGIN
    SELECT * FROM Toy WHERE Toy_ID = toy_no;
END //
DELIMITER ;

How to Use This in phpMyAdmin

Just paste the entire block above into the SQL window and click "Go". The DELIMITER // line tells MySQL to treat // as the end of a full statement instead of ; until we run DELIMITER ; to reset it.

That should resolve the #1064 error and create your stored procedure successfully!

内容的提问来源于stack exchange,提问作者beginIT

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:50:21