我的存储过程语法有什么问题?

What is wrong in my stored procedure syntax?

我收到这个错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1

我正在使用存储过程来检索数据,在此我正在使用分页

这是我的存储过程代码:

  CREATE DEFINER=`root`@`%` PROCEDURE `usp_get_product_wall_details`(
    IN `in_user_id` INT,
    IN `in_product_name` VARCHAR(50),
    IN `in_category_id` INT

,
    IN `in_order_by` VARCHAR(50),
    IN `in_order_type` VARCHAR(50),
    IN `in_page_no` INT,
    IN `in_limit` INT



)
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER

BEGIN


DECLARE var_offset INT;
DECLARE var_limit INT DEFAULT 10;


IF in_limit != 0 THEN
    set var_limit = in_limit;
END IF;

set var_offset = (in_page_no - 1) * var_limit;
set @sql = '';
set @query = '';

    set @query= concat("select SQL_CALC_FOUND_ROWS p.id,p.product_name,p.seller_count,p.rating,p.rating_count,pii.image_url,
    padem.product_mrp,padem.minimum_selling_price,max(padem.discount_price) as discount_price,
    max(padem.discount_percentage) as discount_percentage,pade.enum_value,padem.id as enum_id 
    from product p
    inner join abc padem on padem.product_id = p.id
    INNER JOIN cd pii ON padem.product_id = pii.product_id
    inner join ef pade on pade.id = padem.attribute_dropdown_enum_id
    where p.`status` = 1 and pii.is_thumbnail = 1 and padem.seller_id is not null and
    pii.enum_mapping_id = (select pad.id from product_attribute_dropdown_enum_mapping pad where pad.product_id = padem.product_id and
    pad.attribute_dropdown_enum_id = padem.attribute_dropdown_enum_id and pad.seller_id is null) and
    padem.sort_order = (select min(sort_order) from product_attribute_dropdown_enum_mapping where product_id = padem.product_id group by product_id) 
    and (p.product_name like concat('tropicana','%') or p.product_name like concat('%','tropicana','%')) 
    group by p.id
    order by ",in_order_by," ",in_order_type," limit ", var_offset,",",var_limit);

set @sql = concat(@sql,@query);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

当我执行此过程时出现错误。

但与此同时,如果我 运行 使用一些静态数据在存储过程外进行简单查询,我可以完美地检索数据。

Table 名称已更改

我通过重启 MySQL 服务器找到了解决方案:

sudo service mysql restart