Error while calling MySQL Stored Procedure
Hi whe开发者_如何学编程n I call this procedure in mysql I get an error:
call delete_poll(1,0);
procedure:
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 ;
Error:
Undeclared variable: I
STMT doesn't recognize variables declared in procedure( query ) - and i cannot find how to push output values into variable
But i wonder why are you using prepared statment in "prepared statment" ( procedure ) ?
精彩评论