Thread: updated at a single element in a array using pl/pgsql

updated at a single element in a array using pl/pgsql

From
"Cristian Custodio"
Date:
Can I update a single element in a array?

CREATE OR REPLACE FUNCTION TESTEARRAY() RETURNS CHAR AS '
DECLARE
v_array integer[];
BEGIN
  v_array[1] := 10; -- Parser error at or near ''[''
  RETURN v_array[1];
END;
'language 'plpgsql';

Cristian


Re: updated at a single element in a array using pl/pgsql

From
Dennis Gearon
Date:
All this talk about arrays is that they are finally in pl-pgsql? useful feature! I thought that
arrays were some kind of extension to SQL.

3/12/2003 9:04:23 AM, "Cristian Custodio" <crstian@terra.com.br> wrote:

>
>Can I update a single element in a array?
>
>CREATE OR REPLACE FUNCTION TESTEARRAY() RETURNS CHAR AS '
>DECLARE
>v_array integer[];
>BEGIN
>  v_array[1] := 10; -- Parser error at or near ''[''
>  RETURN v_array[1];
>END;
>'language 'plpgsql';
>
>Cristian
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faqs/FAQ.html
>