无法在红移 UDF 中声明变量



嗨,我无法创建这个函数,它在int&quot附近抛出了一个错误"语法错误。我使用红移

CREATE OR REPLACE FUNCTION stage.calc_enddate( int, int, timestamp)
RETURNS timestamp
LANGUAGE sql
STABLE
AS $$
declare
p int := 0;
begin 
if ($1 >1) then
select $3       
end if
end

$$;

提前感谢Sundar

根据Amazon Redshift的指南链接

数据类型

CREATE OR REPLACE FUNCTION stage.calc_enddate(INT, INT, TIMESTAMP)
RETURNS TIMESTAMP
stable
AS $$
begin 
if ($1 >1) then
select $3       
end if
end

$$ language sql;