On 10/30/07, Gerardo Herzig <gherzig@fmed.uba.ar> wrote:
> Wreird enough to me, need some advice plz!
CREATE OR REPLACE FUNCTION READ_WORDS(BIGINT, INT[])
RETURNS VARCHAR
AS
$$ DECLARE RETURNVALUE VARCHAR; BEGIN SELECT ARRAY_TO_STRING(ARRAY( SELECT WORD FROM WORDS WHERE PAGE_ID=$1
AND WORD_POSITION = ANY ($2) ), ' ') INTO RETURNVALUE; RETURN RETURNVALUE; END;
$$ LANGUAGE PLPGSQL;
SELECT READ_WORDS(99466, '{2994,2995,2996}');
See:
http://www.postgresql.org/docs/8.2/static/arrays.html