我尝试按照以下代码创建存储过程时遇到麻烦的问题
但显示错误


  #1064-您的SQL语法有误;检查与您的MySQL服务器版本相对应的手册以获取在第5行附近使用的正确语法


这是我的代码感谢您的建议。

CREATE DEFINER=root@localhost PROCEDURE item_page_insert(IN cid INT, IN it_title VARCHAR(200), IN tumbnail VARCHAR(300), IN publish_date DATE, IN cover_set VARCHAR(20), IN pcontent TEXT, IN status INT) MODIFIES SQL DATA
 BEGIN
DECLARE mpid INT;
SELECT max(pid)+1 INTO mpid
FROM tbpage;
INSERT INTO tbite(cid, pid, it_title, tumbnail, publish_date, cover_set)
VALUES(cid,
       mpid,
       it_title,
       tumbnail,
       publish_date,
       cover_set);
INSERT INTO tbpage(pid, pcontent, set_date, status)
VALUES(mpid,
       pcontent,
       now(),
       status); END;

 DELIMITER ;

最佳答案

它应该是
    声明mpid AS INT;

试试那个

关于mysql - phpmyadmin wamp mysql无法在过程中声明变量,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35197005/

10-15 07:59