У меня есть синтаксическая ошибка при запуске хранимой процедуры, я получаю ее рядом с + v_RowIndex + 'And (' + v_RowIndex + '+' + v_NoOfRows + ')';
Кто-нибудь может мне помочь?
DELIMITER //; //
CREATE PROCEDURE GetProducts(v_WhereClause NATIONAL VARCHAR(4000),
v_SortExpression NATIONAL VARCHAR(128),
v_RowIndex INT,
v_NoOfRows INT)
BEGIN
DECLARE v_SQL NATIONAL VARCHAR(4000);
IF (v_WhereClause != '') then
SET v_WhereClause = CONCAT('WHERE ',char(13),v_WhereClause);
end if;
IF (v_SortExpression != '') then
SET v_SortExpression = CONCAT('ORDER BY ',v_SortExpression);
end if;
SET v_SQL = CONCAT('SQLWAYS_EVAL# AS (
SELECT ROW_NUMBER() OVER (',v_SortExpression,
'SQLWAYS_EVAL#
[Id],
[Name],
[Description],
[Unit],
[UnitPrice],
[CreateDate]
FROM
[Product]
',v_WhereClause,'SQLWAYS_EVAL#
Row between ')+v_RowIndex+' And ('+v_RowIndex+' + '+v_NoOfRows+')';
SET @SWV_Stmt = v_SQL;
PREPARE SWT_Stmt FROM @SWV_Stmt;
EXECUTE SWT_Stmt;
DEALLOCATE PREPARE SWT_Stmt;
SET v_SQL = CONCAT('SELECT COUNT(Id)
FROM
Product ',v_WhereClause);
SET @SWV_Stmt = v_SQL;
PREPARE SWT_Stmt FROM @SWV_Stmt;
EXECUTE SWT_Stmt;
DEALLOCATE PREPARE SWT_Stmt;
END;
//