我正在尝试使用以下代码创建存储过程:
CREATE PROCEDURE films
@filmTitle varchar(25)
AS
SELECT *
FROM films
WHERE film_title = @film_title
但我一直收到以下错误:
#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 '@filmTitle varchar(25)
AS
SELECT *
FROM films
WHERE film_title = @film_title' at line 2
出了什么问题?我无法理解。
此外,我尝试通过Phpmyadmin中的例程创建存储过程,但每当我执行代码时它都不返回
这是我日常工作的配置:
答案 0 :(得分:1)
试试这个
DELIMITER $$
CREATE PROCEDURE `films` (IN p_filmTitle VARCHAR(25))
BEGIN
SELECT *
FROM films
WHERE film_title = p_filmTitle;
END$$
DELIMITER ;