Re: Passing array to PL/SQL and looping

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Passing array to PL/SQL and looping
Дата
Msg-id web-1731886@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Passing array to PL/SQL and looping  (Peter Atkins <peter.atkins@NXCD.com>)
Ответы Re: Passing array to PL/SQL and looping
Список pgsql-sql
Greg,

> CREATE FUNCTION test_array( ) RETURNS VARCHAR[] AS '
> DECLARE 
>     return_array VARCHAR[];
> BEGIN
>     return_array[0] := ''test'';
>     return_array[1] := ''test 1'';
>     return_array[2] := ''test 2'';
> RETURN (return_array);
> END;'
> LANGUAGE 'plpgsql';

No, it's not possible to do the above.   This is a flaw in the current
implementation of PL/pgSQL that will not be resolved until we attract
some new Postgres hackers who really care about upgrading PL/pgSQL.

Currently, if you want to use an array, it has to be passed as a
parameter, or come from an external table.   You cannot declare an
Array data type.  Annoying, really.

-Josh Berkus


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: Date/Time types
Следующее
От: Jean-Luc Lachance
Дата:
Сообщение: Re: Dublicates pairs in a table.