【发布时间】:2012-04-30 03:50:07
【问题描述】:
我试图在 plpgsql 函数中循环一个整数数组 (integer[])。像这样的:
declare
a integer[] = array[1,2,3];
i bigint;
begin
for i in a
loop
raise notice "% ",i;
end loop;
return true;
end
在我的实际用例中,整数数组a 作为参数传递给函数。我收到此错误:
ERROR: syntax error at or near "$1" LINE 1: $1
如何正确循环遍历数组?
【问题讨论】:
标签: arrays postgresql loops plpgsql postgresql-8.4