我在存储过程中遇到以下错误:

DELIMITER $$
DROP PROCEDURE IF EXISTS `comm_pay_intro`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `comm_pay_intro`(IN `id` VARCHAR(20),IN
`comm_type` VARCHAR(50))
BEGIN
DECLARE i INTEGER;
 DECLARE userid varchar(20);
 DECLARE rateid int(10);
 DECLARE levels int(1);
 DECLARE idx INTEGER;
DECLARE curs1 CURSOR FOR (SELECT `id` , `user_id`
 FROM `temp_table` order by `id`);
OPEN curs1;
FETCH curs1 INTO idx,userid;
Select `level_id` into rateid , `levels` into levels FROM `user_levels`
 INNER JOIN `commission_type` ON `type_id`=`Commission_Type` WHERE
`Commission_Type`=comm_type and `levels`=idx
order by `levels`;
   insert into user_commission(rate_id, user_id)
VALUES(rateid,userid);
CLOSE curs1;
END$$
DELIMITER ;


错误:


  您的SQL语法有误。检查与您的MariaDB服务器版本相对应的手册以获取正确的语法,以便在' from user_levels
  第13行的INNER JOIN commission_type ON type_id =`Comm'

最佳答案

像这样

 Select `level_id`,`levels` into rateid  levels FROM `user_levels`

关于mysql - 存储过程查询中的错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41041435/

10-10 13:31