Bug #33856 | LIMIT clause doesn't accept any variable or other, just constant numbers | ||
---|---|---|---|
Submitted: | 14 Jan 2008 0:35 | Modified: | 26 Mar 2008 10:18 |
Reporter: | Stéphane GRAZIANO | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S4 (Feature request) |
Version: | Any | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | LIMIT CLAUSE VARIABLE STORED PROCEDURE |
[14 Jan 2008 0:35]
Stéphane GRAZIANO
[14 Jan 2008 13:27]
Susanne Ebrecht
Many thanks for writing a feature request.
[14 Jan 2008 13:28]
Susanne Ebrecht
I looked through SQL Standard, but I couldn't found something contra or pro this.
[14 Jan 2008 13:30]
Stéphane GRAZIANO
test
[14 Jan 2008 13:33]
Stéphane GRAZIANO
Thanks Susanne ^^ It will be great if this were implemented in the next build... Humn, Just a little mistake in my bug description (correction in uppercase), Suggested fix: In order to fix, go to the parser file sql_yacc.yy to the LIMIT_OPTION line and change
[26 Mar 2008 10:18]
Susanne Ebrecht
Many thanks for writing a feature request. Some others also have had the same wish as you. This bug is a duplicate of bug #6673 and bug #8094.
[9 Jul 2008 3:10]
Ilkka Huotari
Please add this. Not having this leads to horrible code in stored procedures.
[24 Oct 2008 13:31]
Franck Andriano
Idem, add something that works... nothing in 6.0 alpha!
[17 Feb 2010 16:14]
Pat McGee
Gert's suggestion earlier works nicely as a workaround. Here it is again with slightly different syntax. DELIMITER $$ CREATE PROCEDURE get_product_range ( IN _START INTEGER, IN _LIMIT INTEGER ) BEGIN PREPARE STMT FROM " SELECT * FROM tblProduct LIMIT ?,? "; SET @START = _START; SET @LIMIT = _LIMIT; EXECUTE STMT USING @START, @LIMIT; END $$ DELIMITER ;