| From: | Michael Moore <michaeljmoore(at)gmail(dot)com> |
|---|---|
| To: | postgres list <pgsql-sql(at)postgresql(dot)org> |
| Subject: | How to manually load RETURNS SETOF RECORD? |
| Date: | 2015-12-08 19:34:09 |
| Message-ID: | CACpWLjNhf9+9qZhVBBc+Wy9cdo3hXKHSEYsZweoj9nitMJM8JA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
CREATE OR REPLACE FUNCTION PXPORTAL_COMMON_helper.fn_plpgsqltestmulti(
param_subject varchar,
OUT test_id integer,
OUT test_stuff text)
RETURNS SETOF record
AS
$$
BEGIN
_record.test_id[0] := 100;
_record.test_id[1] := 555;
_record.test_stuff[0] := 'cat';
_record.test_stuff[1] := 'cow';
END;
$$
LANGUAGE 'plpgsql' VOLATILE;
*select test_id from PXPORTAL_COMMON_helper.fn_plpgsqltestmulti('123');*
ERROR: subscripted object is not an array
CONTEXT: PL/pgSQL function
pxportal_common_helper.fn_plpgsqltestmulti(character varying) line 3 at
assignment
********** Error **********
ERROR: subscripted object is not an array
SQL state: 42804
Context: PL/pgSQL function
pxportal_common_helper.fn_plpgsqltestmulti(character varying) line 3 at
assignment
*What is the correct way to accomplish this?*
*TIA, Mike*
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2015-12-08 19:49:09 | Re: How to manually load RETURNS SETOF RECORD? |
| Previous Message | David G. Johnston | 2015-12-08 19:15:32 | Re: call by reference vs call by value |