当我在mysql中调用此过程时,我收到错误:
call delete_poll(1,0);
过程:
DELIMITER $$
DROP PROCEDURE IF EXISTS `prj`.`delete_poll` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `delete_poll`(IN b_id int,IN rowNumber int)
BEGIN
declare I int;
PREPARE STMT FROM " select id into I from poll
where blog_id=b_id limit ?,1 ";
SET @start = rowNumber;
EXECUTE STMT USING @start;
delete from poll
where id=I;
END $$
DELIMITER ;
错误:
未声明的变量:我
答案 0 :(得分:0)
STMT无法识别在过程(查询)中声明的变量 - 我无法找到如何将输出值推送到变量
但我想知道你为什么在“准备好的陈述”(程序)中使用准备好的陈述?