From: Rodrigo De León <rdeleonp@gmail.com>
To: Gerardo Herzig <gherzig@fmed.uba.ar>
Cc: pgsql-sql@postgresql.org
Subject: Re: puzzled by SELECT INTO
Date: Tue, 30 Oct 2007 15:57:21 -0500
Message-ID: <a55915760710301357s47bf6ecbyb6bd8de675b903cd@mail.gmail.com> (raw)
In-Reply-To: <47279757.50602@fmed.uba.ar>
References: <47279757.50602@fmed.uba.ar>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: rdeleonp@gmail.com, gherzig@fmed.uba.ar
Subject: Re: puzzled by SELECT INTO
In-Reply-To: <a55915760710301357s47bf6ecbyb6bd8de675b903cd@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox