Reputation: 1832
I can't make this stored procedure load/save, which is very strange because the insert one line version of the procedure works with no problem. I am NOT trying to overload, I gave both procedures and all the variables different names The workbench is telling me that the problem lies with the parenthesis after "flavidtwo". Reversing the order of the inserts doesn't fix the problem, it just starts complaining about the end of the other line instead.
CREATE PROCEDURE `LinkTwoFlavors`(in selzidtwo INT, in flavidone INT, in flavidtwo INT)
BEGIN
INSERT INTO `readinga_seltzer`.`AscSeltzerFlavor` (`SeltzerID`,`FlavorID`) VALUES (selzidtwo, flavidtwo);
INSERT INTO `readinga_seltzer`.`AscSeltzerFlavor` (`SeltzerID`,`FlavorID`) VALUES (selzidtwo, flavidone);
END
Upvotes: 0
Views: 169
Reputation: 1976
Actually, it's complaining about the semi-colon, not the parenthesis. You need to set a different DELIMITER before your procedure (resetting it again afterwards) so that mysql knows to treat the whole procedure as a single statement otherwise it thinks it should end after your first INSERT statement. Your procedure should then look like this
DELIMITER //
CREATE PROCEDURE `LinkTwoFlavors`(in selzidtwo INT, in flavidone INT, in flavidtwo INT)
BEGIN
INSERT INTO `readinga_seltzer`.`AscSeltzerFlavor` (`SeltzerID`,`FlavorID`) VALUES (selzidtwo, flavidtwo);
INSERT INTO `readinga_seltzer`.`AscSeltzerFlavor` (`SeltzerID`,`FlavorID`) VALUES (selzidtwo, flavidone);
END //
DELIMITER ;
Upvotes: 1