skibikegolf Posted November 19, 2007 Share Posted November 19, 2007 When creating a new stored procedure I get the following error. I've spent about 3 hours trying to what-if and solve the matter to no avail. If someone can see the problem, I would be grateful. Error Code : 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 'LOOP myloop; END' at line 49 (0 ms taken) Here is the .sql script DELIMITER $$ DROP PROCEDURE IF EXISTS `naasf`.`parseHistorical`$$ CREATE PROCEDURE `naasf`.`parseHistorical`() /*LANGUAGE SQL | [NOT] DETERMINISTIC | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } | SQL SECURITY { DEFINER | INVOKER } | COMMENT 'string'*/ BEGIN Declare eID varchar(6); Declare aID varchar(2); Declare race enum('amg','ams','awg','aws','bmg','bms','bwg','bws','sbm','sbw'); Declare fName varchar(20); Declare lName varchar(20); Declare bib smallint(6); Declare grp enum('group1','group2'); Declare run1Time decimal(6,2); Declare run2Time decimal(6,2); Declare fs enum('fin','dnf1','dnf2','dq1','dq2','dns1','dns2'); Declare ps enum('ae','re','fe','gu','de'); Declare Done smallint default 0; Declare dummy1 enum('yes','no'); Declare dummy2 mediumint(9); Declare dummy3 mediumint(9); Declare nID mediumint(9); Declare edID mediumint(9); Declare rID mediumint(9); Declare racing enum('yes','no'); Declare skiClass enum('A','B','SB'); Declare sbRace enum('yes','no'); Declare mycursor Cursor for select * from tbl_historical; Declare continue handler for NOT FOUND SET Done=1; open mycursor; myloop: loop fetch mycursor into dummy3, eID, race, lName, fName, aID, bib, grp, run1Time, run2Time, fs, ps, dummy1, dummy2; If done=1 then leave myloop; end if; set nID=get_naasfID(aID, lName, fName); if left(race,1)='a' then set racing='yes'; set skiClass='A'; else if left(race,1)='b' then set racing='yes'; set skiClass='B'; else if left(race,2)='sb' then set sbRace='yes'; set skiClass='SB'; end if; set edID=get_eventDetail_ID(eID, nID, ps, racing, skiClass, sbRace); set rID=get_raceID(edID, race); insert into tbl_raceDetail (race_ID, eventDetail_ID, raceDetail_bibNumber, raceDetail_group, raceDetail_run1time, raceDetail_run2time, raceDetail_finishStatus) values (rID, edID, bib,grp,run1Time, run2Time, fs); END LOOP myloop; END$$ DELIMITER ; TIA skibikegolf Quote Link to comment https://forums.phpfreaks.com/topic/77899-syntax-error-in-stored-procedure-cant-find-the-problem/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.