Re: puzzled by SELECT INTO - Mailing list pgsql-sql

From Gerardo Herzig
Subject Re: puzzled by SELECT INTO
Date
Msg-id 472874E0.4060104@fmed.uba.ar
Whole thread Raw
In response to Re: puzzled by SELECT INTO  ("Rodrigo De León" <rdeleonp@gmail.com>)
List pgsql-sql
Rodrigo De León wrote:

>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
>
>
>  
>
Mmmm, yes, that make perfect sense. I did 'resolve' the previous 
situation by using EXECUTE, i will try your solution now.

Gracias Rodrigo.
Gerardo


pgsql-sql by date:

Previous
From: "Fernando Hevia"
Date:
Subject: Re: Perfomance benefit using Min() against order by & limit 1?
Next
From: Andreas Joseph Krogh
Date:
Subject: Returning the total number of rows as a separate column when using limit