Seems like MySQL can only take numeric constants in the LIMIT syntax. Directly from MySQL documentation:
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INTBEGINDECLARE M INT;SET M=N-1;RETURN (SELECT DISTINCT Salary from Employee e order by Salary desc LIMIT M, 1);END
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants (except when using prepared statements).