Zkuste to uvnitř SP
SET @String1 = concat(concat(concat(concat("SELECT field1,field2 FROM table1 WHERE field3 = ",sp_var1," && field4 = "),sp_var2," LIMIT "),sp_Var_skip,","),sp_var_count);
PREPARE Stmt FROM @String1;
EXECUTE Stmt;
SET @String1 = ""
Případně
DELIMITER $
CREATE PROCEDURE `tmp`()
BEGIN
PREPARE STMT FROM "SELECT * FROM users LIMIT ?,?";
END$
DELIMITER;
SET @a=2;
SET @b=1;
CALL tmp();
EXECUTE STMT USING @a, @b;
Další informace o tomto zde