Quincy
Quincy

Reputation: 3

Can't create Stored Procedure

I'm trying to make a Stored Procedure using the following code:

CREATE PROCEDURE films
@filmTitle varchar(25)
AS
SELECT *
FROM films
WHERE film_title = @film_title

But I keep getting the following error:

#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 

What is going wrong? I can't figure it out.

Also I tried to make a Stored Procedures via the routines in Phpmyadmin but whenever i execute the code it returns nothing

This is the configuration of my routine:

https://i.sstatic.net/TjgUE.jpg

Upvotes: 0

Views: 127

Answers (1)

Mad Dog Tannen
Mad Dog Tannen

Reputation: 7244

Try like this

DELIMITER $$
CREATE PROCEDURE `films` (IN p_filmTitle VARCHAR(25))
BEGIN
SELECT *
FROM films
WHERE film_title = p_filmTitle;
END$$

DELIMITER ;

Upvotes: 1

Related Questions