我在下面尝试过;
CREATE PROCEDURE GetHs(IN FRVDate TIMESTAMP, IN TRVDate TIMESTAMP, IN RESValue NUMERIC(19,2),
RangeType VARCHAR(20), HRID VARCHAR(36))
READS SQL DATA
DYNAMIC RESULT SETS 1
BEGIN ATOMIC
DECLARE TABLE myList(MValue NUMERIC(19,2), Price NUMERIC(19,2), FRVDate TIMESTAMP,TRVDate TIMESTAMP);
DECLARE Counter INT;
DECLARE dateDifference NUMERIC(19,2);
DECLARE for_day,for_week VARCHAR(20);
SET for_day = 'DAY';
SET for_week = 'WEEK';
IF RangeType = for_day THEN
BEGIN ATOMIC
----statements----
END
ELSEIF RangeType = for_week THEN
BEGIN ATOMIC
----statements----
END
END IF
SELECT MValue,Price,FRVDate,TRVDate FROM myList
END
我收到user lacks privilege or object not found: DAY
的错误。我可以不将值设置为声明的标量变量吗?
在文档中,它说要以这种格式使用。来自DOC;
BEGIN ATOMIC
DECLARE temp_zero DATE;
DECLARE temp_one, temp_two INTEGER DEFAULT 2;
DECLARE temp_three VARCHAR(20) DEFAULT 'no name';
-- more statements ...
SET temp_zero = DATE '2010-03-18';
SET temp_two = 5;
-- more statements ...
END
我在这里做错了什么?
注意:最近开始学习HSQL并使用版本2.3.3