manirana007
Programmer
Hello,
I have written a stored procedure in mySql (ver 5.0) and I am getting an error which just says that there is a syntax error at 2nd line. I have done a lot of research and checked this code many times but can't figure out what could be the problem. Any help would be really appreciated. Thanks. The code is as follows:
CREATE PROCEDURE insertScoreOrSchedule(
@date date, @home_team_name varchar(55),
@away_team_name varchar(55), @home_score int(11),
@away_score int(11), @period varchar(20),
@time_left varchar(20), @conference_name varchar(55))
BEGIN
Declare @home_team_id bigint;
declare @away_team_id bigint;
declare @conference_id bigint;
select home_team_id
into @home_team_id
from team
where st_team_school_id = CONCAT(@conference_name, '::', @home_team_name);
select away_team_id
into @away_team_id
from team
where st_team_school_id = CONCAT(@conference_name, '::', @away_team_name);
select conference_id
into @conference_id
from conference
where conference_name = @conference_name;
insert into scheduleandscore
(home_team_id, away_team_id, date, home_team_name, away_team_name, home_score,
away_score, period, time_left, conference_name, conference_id)
values
(@home_team_id, @away_team_id, @date, @home_team_name, @away_team_name,
@home_score, @away_score, @period, @time_left, @conference_name, @conference_id);
END;
I have written a stored procedure in mySql (ver 5.0) and I am getting an error which just says that there is a syntax error at 2nd line. I have done a lot of research and checked this code many times but can't figure out what could be the problem. Any help would be really appreciated. Thanks. The code is as follows:
CREATE PROCEDURE insertScoreOrSchedule(
@date date, @home_team_name varchar(55),
@away_team_name varchar(55), @home_score int(11),
@away_score int(11), @period varchar(20),
@time_left varchar(20), @conference_name varchar(55))
BEGIN
Declare @home_team_id bigint;
declare @away_team_id bigint;
declare @conference_id bigint;
select home_team_id
into @home_team_id
from team
where st_team_school_id = CONCAT(@conference_name, '::', @home_team_name);
select away_team_id
into @away_team_id
from team
where st_team_school_id = CONCAT(@conference_name, '::', @away_team_name);
select conference_id
into @conference_id
from conference
where conference_name = @conference_name;
insert into scheduleandscore
(home_team_id, away_team_id, date, home_team_name, away_team_name, home_score,
away_score, period, time_left, conference_name, conference_id)
values
(@home_team_id, @away_team_id, @date, @home_team_name, @away_team_name,
@home_score, @away_score, @period, @time_left, @conference_name, @conference_id);
END;