Search Postgresql Archives

Re: setof or array as input parameter to postgresql 8.2 functions

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

 



> I have to pass a set of values and arrays in postgresql 8.2 
> functions. But I am not getting any help on that. Please let 
> me know if any one has idea.

Something like this?

CREATE OR REPLACE FUNCTION sample(avalue integer, anarray text[])
   RETURNS void LANGUAGE plpgsql STRICT AS
$$DECLARE
   i integer;
BEGIN
   -- I can access the value
   i := avalue;
   -- I can access the array
   i := anarray[2];
END;$$;

Called like

SELECT sample(3, ARRAY[1, 2, 3]);

Yours,
Laurenz Albe


[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