gpt4 book ai didi

php - php mysql 中的存储过程 - phpmyadmin

转载 作者:行者123 更新时间:2023-11-30 00:13:00 27 4
gpt4 key购买 nike

我想通过 PHPMyAdmin 在 PHP MySQL 中创建一个存储过程。当我把它作为 SQL 命令时:

CREATE PROCEDURE getBanks() 
BEGIN
select * from cp_banks; END

我收到以下错误:

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 1 STR: // SQL: // CREATE PROCEDURE getBanks() BEGIN select * from cp_banks;// CREATE PROCEDURE getBanks() BEGIN select * from cp_banks;// CREATE PROCEDURE getBanks() BEGIN select * from cp_banks;

MySQL 说:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '//

CREATE PROCEDURE getBanks() BEGIN select * from cp_banks' at line 1

请告诉我错误来自哪里。

最佳答案

您需要在创建过程之前定义分隔符或调用它。

delimiter //
CREATE PROCEDURE getBanks()
BEGIN
select * from cp_banks;
END//

由于您使用的是phpmyadmin,因此您应该删除分隔符行并在GUI中设置它; http://i.stack.imgur.com/Jfb8q.png

关于php - php mysql 中的存储过程 - phpmyadmin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23894663/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com