Pl/PgSql: Loop over Array

From: axel(at)pizza(dot)home(dot)kosnet(dot)com (Axel Straschil)
To: pgsql-general(at)postgresql(dot)org
Subject: Pl/PgSql: Loop over Array
Date: 2003-05-16 10:18:15
Message-ID: slrnbc9en7.711.axel@pizza.home.kosnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ist it possible to loop over an array:

CREATE FUNCTION atest(INT[]) RETURNS TEXT AS '
DECLARE
myA ALIAS FOR $1;
myI INT;
myRet TEXT='''';
BEGIN
FOR myI IN myA LOOP
myRet=myRet||''x''||myI;
END LOOP;
RETURN myRet;
END;
' LANGUAGE 'plpgsql';

This Examle is not working ;-(

Thanks,
AXEL.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bartlomiej Frackiewicz 2003-05-16 11:46:50 Rollback when value too long
Previous Message Tapan Trivedi 2003-05-16 08:49:06 Re: Migration from SQLServer