Bug #21761 limit interval
Submitted: 21 Aug 2006 17:46 Modified: 4 Oct 2008 23:13
Reporter: João Paulo Torres Corrêa Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DML Severity:S4 (Feature request)
Version:5.0.24 OS:Linux (Suse 10.1)
Assigned to: CPU Architecture:Any

[21 Aug 2006 17:46] João Paulo Torres Corrêa
Description:
the offset of the limit parameter do not accept a declared variable in procedures or simple queries.

How to repeat:
CREATE FUNCTION ... (...) returns ...
BEGIN
DECLARE line int DEFAULT 1;
select ... from ... where .... limit 0,1 into x;
WHILE ... DO
set x = concat (x,',',y);
select ... from ... where .... limit line,1 into x;
set line = line + 1;
END WHILE;
RETURN ...;
END;

Suggested fix:
the parameter offset of the limit accept a variable.
[21 Aug 2006 17:49] João Paulo Torres Corrêa
The order os the variables x and y are wrong in some point of the example code.
[28 Aug 2006 9:30] Valeriy Kravchuk
Thank you for a reasonable feature request.
[4 Oct 2008 23:13] Konstantin Osipov
Duplicate of Bug#8094 "Variables in LIMIT clause".