Using variable in a LIMIT clause in MySQL
问题 I am writing a stored procedure where I have an input parameter called my_size that is an INTEGER . I want to be able to use it in a LIMIT clause in a SELECT statement. Apparently this is not supported, is there a way to work around this? # I want something like: SELECT * FROM some_table LIMIT my_size; # Instead of hardcoding a permanent limit: SELECT * FROM some_table LIMIT 100; 回答1: A search turned up this article. I've pasted the relevant text below. Here's a forum post showing an example