在mysql中创建存储过程时出现以下错误,如下所示
ERROR 1064 (42000): 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 8
下面是我的存储过程
mysql> delimiter //
mysql> create procedure music_procedure(in movie_name varchar(100),in movie_image varchar(100),in music_director varchar(150),in cast varchar(150),in songtitle varchar(150),in duration time,in artist varchar(100),in lyricist varchar(100),in status varchar(50))
-> begin
-> if not exists (select movie_name from music where music.movie_name=movie_name) then
-> insert into music(movie_name,movie_image,music_director,cast) values(movie_name,movie_image,music_director,cast);
-> insert into music_details(songtitle,duration,artist,lyricist,status,music_id) values(songtitle,duration,artist,lyricist,status,(select music_id from music where music.movie_name=movie_name));
-> else
-> insert into music_details(songtitle,duration,artist,lyricist,status,music_id) values(songtitle,duration,artist,lyricist,status,(select music_id from music where music.movie_name=movie_name));
-> end
-> //