Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error in MySQL stored procedure. 1

Status
Not open for further replies.

manirana007

Programmer
Jul 11, 2006
17
GB
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;
 
Did you set the delimiter to something else than ';'? If you look at examples of stored procedures, you will see that is done to prevent mysql thinking the procedure is ended at the first semicolon within the procedure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top