Quantcast
Channel: MySQL Forums - Install & Repo
Viewing all articles
Browse latest Browse all 7247

Correct procedure does not run (1 reply)

$
0
0
Hello people

I realise this is forum for configuration and not for stored procedures. The code below to create a stored procedure is correct and verified by an other member here on the forums but it does't work when I run it.

On the same MySQL server I have a working wordpress installation. I am using a new database (utf8) and have successfully created teh tables but the sp won't be created. As the code of the SP has been verified I suspect that there might be something wrong with my installation/configuration.

Any and all tips/suggestions will be greatly apreciated!

The code below works when I create the tables but gives me the following error when I create the sp: SQL 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 '' at line 10

use movies;

CREATE TABLE Film (
	FilmID INT(11) NOT NULL AUTO_INCREMENT,
	BoxNr INT(11) NULL DEFAULT NULL,
	SlotNr INT(11) NULL DEFAULT NULL,
	ImdbLink VARCHAR(250) NULL DEFAULT NULL,
	PRIMARY KEY (FilmID)
)


create table Name (
	NamnID int,
	FilmID int,
	LanguageCode varchar(50),
	FilmName varchar(250)
);


Create table Genre (
	GenreID int,
	FilmID int,
	GenreCode varchar(50),
	GenreName varchar (250)
);



create procedure AddFilm ( 
	in inBoxNr int, 
	in inSlotNr int, 
	in inImdbLink varchar(250), 
	in inLanguageCode varchar(50), 
	in inFilmName varchar(250), 
	in inGenreName varchar (250) 
) 
BEGIN 
declare varFilmID int;
	Insert into `Film`
	( 
		BoxNr, 
		SlotNr, 
		ImdbLink 
	) 
	VALUES (inBoxNr, inSlotNr, inImdbLink); 
	set varFilmID = LAST_INSERT_ID(); 
	
	Insert into `Name`
	( 
		FilmID, 
		LanguageCode, 
		FilmName 
	) 
	VALUES (varFilmId, inLanguageCode, inFilmName); 
	
	Insert into `Genre` 
	( 
		FilmID,	
		GenreName 
	) 
	VALUES (varFilmId, inGenreName); 
END

Viewing all articles
Browse latest Browse all 7247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>