Redshift 存储过程在 "integer" 附近出现 while 循环语法错误的问题



正在处理AmazonRedshift存储过程。在while循环语法错误附近出现问题;整数";

create or replace procedure WHILE_COM(REC_COUNT INT)
AS $$ 
DECLARE 
I INTEGER =1
SET REC_COUNT=SELECT COUNT(*) FROM table
BEGIN
WHILE I<=REC_COUNT LOOP
WITH FIRST_RECORD AS
(SELECT * FROM ods_epremis.new_old_merge
where new_old_merge.claim_oid IN(select TOP 1 claim_oid from ods_epremis.new_old_merge order by clain_oid)),
MERGE_RECORD AS
(SELECT * from ode_epremis.new_old_merge JOIN FIRST_RECORD
ON T1_accountno=T2_accountno)
insert into targettable (select * from MERGE_RECORD)
I=I+1
END LOOP
END
$$ LANGUANGE plpgsql;

根据PL/pgSQL结构-Amazon Redshift中的示例,变量应设置为:=,而不仅仅是=:

CREATE PROCEDURE update_value() AS $$
DECLARE
value integer := 20;
BEGIN
...

它还在命令末尾显示冒号(;(。

相关内容

  • 没有找到相关文章

最新更新