create or replace function fibonacci(int) returns int
as $$
declare
a int;
res int := 0;
begin
a := $1;
if(a = 1 or a = 2) then
res :=1;
else
res := fibonacci(a - 2) + fibonacci(a - 1);
end if;
return res;
end;
language plpgsql;
显示的错误消息并且我没有看到错误,因为我以多种方式进行了探测,同样继续显示的是斐波那契数列
ERROR: una cadena separada por $ está inconclusa en o cerca de «$$
declare
a int;
res int := 0;
begin
a := $1;
if(a = 1 or a = 2) then
res :=1;
else
res := fibonacci(a - 2) + fibonacci(a - 1);
end if;
return res;
end;
language plpgsql;»
LINE 3: as $$
^
SQL state: 42601
Character: 106