Re: Is there a bug in FOR i IN 1..10 LOOP (8.4.4)? - Mailing list pgsql-general

From Nick
Subject Re: Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?
Date
Msg-id 7fd5be50-b279-4233-aa39-7fe9e5afc067@q40g2000prg.googlegroups.com
Whole thread Raw
List pgsql-general
Woops, figured it out. Just needed to declare the num_var := '';

On Sep 11, 10:45 pm, Nick <nboutel...@gmail.com> wrote:
> CREATE FUNCTION test() RETURNS text
>     LANGUAGE plpgsql
>     AS $$DECLARE
>   num_var TEXT;
> BEGIN
>   FOR i IN 1..10 LOOP
>     num_var := num_var || ',' || i;
>   END LOOP;
>   RETURN num_var;
> END;$$;
>
> SELECT test();
>
> returns NULL


pgsql-general by date:

Previous
From: sunpeng
Date:
Subject: Fwd: how to write the sql if i want to find a geometry's d-distance neighbors?
Next
From: Phui Hock
Date:
Subject: Re: How to inherit search_path from template