Search Postgresql Archives

Re: Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Woops, figured it out. Just needed to declare the num_var := '';

On Sep 11, 10:45 pm, Nick <nboutel...@xxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux