Not sure I’m in the correct here.
I have a stored procedure in MySQL, which limits results like so:
...
ORDER BY param_sort1, param_sort2
LIMIT param_start, param_end
;
Both *param_start* and *param_end* are passing in as integers like so:
...
IN `param_start` INT,
IN `param_end` INT
...
While this is working on my developement server using the latest MySQL, the production server is still running MySQL 5.0.88 and throws a syntax error on the LIMIT clause. If I comment it out, it works correctly.
I’m fairly new to MySQL and completely clueless regarding how to do this correctly in older versions of MySQL.
Question:
Any tips how to get this working?
THANKS!
You cannot use variables or parameters for LIMIT arguments in MySQL 5.0. This feature was supported in MySQL 5.5.
As a workaround – construct a query string and execute it using prepared statements.
something like this (edited):