Bug #20745 LIMIT can't work with local variables
Submitted: 28 Jun 2006 6:04 Modified: 28 Jun 2006 7:20
Reporter: Falk Nisius Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.22 OS:Microsoft Windows (Windows 2000)
Assigned to: CPU Architecture:Any

[28 Jun 2006 6:04] Falk Nisius
Description:
If you have stored Function or Procedure like

...
BEGIN
  DECLARE cnt INT;
  SET cnt = 10;
  SELECT * FROM table ORDER BY comlumn LIMIT cnt;
  ...
END;

you always get an error at cnt;
A workaround with prepared statements doesn't work in a function;

How to repeat:
see above

Suggested fix:
check your SQL-Parser
[28 Jun 2006 7:20] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Please, read about limitations of user variables here: http://dev.mysql.com/doc/refman/5.0/en/user-variables.html