开发者

Error while calling MySQL Stored Procedure

开发者 https://www.devze.com 2023-03-20 09:45 出处:网络
Hi whe开发者_如何学编程n I call this procedure in mysql I get an error: call delete_poll(1,0);

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

精彩评论

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