as an alternative solution, use prepare statement to identifiy limit variable like this following code:
delimiter //
drop procedure if exists limitTest //
create procedure limitTest( idin int )
begin
set @sql = concat('select * from mytable order by id limit ', idin );
prepare stmt from @sql;
execute stmt;
drop prepare stmt;
end //
delimiter ;
call limittest(5);
related documents:
http://bugs.mysql.com/bug.php?id=11918
http://forums.mysql.com/read.php?98,28212
http://bugs.mysql.com/bug.php?id=33856
Comments