我有以下 SQL 脚本:
PROCEDURE "P_OVERVIEW" ()
LANGUAGE SQLSCRIPT
READS SQL DATA
AS
BEGIN
DECLARE I INT = 0;
WHILE :I < 24 DO
SELECT A, B, COUNT(A) AS COUNT, LAST_DAY(ADD_MONTHS(CURRENT_TIMESTAMP, -:I)) AS "DATE", I
FROM Table
WHERE LAST_DAY(ADD_MONTHS(CURRENT_TIMESTAMP, -:I)) BETWEEN ENTRY_DATE AND VALID_UNTIL
GROUP BY A, B
ORDER BY B, A;
I := I+1;
END WHILE;
END;
我在 SAP Cloud Platform 上的 .hdbprocedure-File 中使用它。部署工作正常。当我用 调用该过程时,CALL P_OVERVIEW()
我只是在I = 0
. 发生这种情况的任何想法?