开发者

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 ) ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜