pl/pgsql how to return multiple values from a function

From: "jack" <datactrl(at)tpg(dot)com(dot)au>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: pl/pgsql how to return multiple values from a function
Date: 2003-03-09 03:33:44
Message-ID: 000901c2e5ec$b1411430$1400a8c0@jac
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi, all

I use "RETURNS RECORD" to return a multiple values from a function as
following but it doesn't work at all. Or is there any other way to do it?
Thank you jin advance!
;-----
CREATE OR REPLACE FUNCTION tesP_returnRec2( ) RETURNS INTEGER AS'
DECLARE
rec RECORD;
BEGIN
SELECT INTO rec tesP_returnRec1();
RAISE NOTICE ''jj=%, ss=%'', rec.jj,rec.ss;
RETURN 0;
END;'
LANGUAGE 'PLPGSQL';
;-------
CREATE OR REPLACE FUNCTION tesP_returnRec1( ) RETURNS RECORD AS'
DECLARE
rec RECORD;
BEGIN
SELECT INTO rec
CAST(100 AS INTEGER) AS jj,
CAST(''ABC'' AS VARCHAR(10)) AS ss;
RETURN rec;
END;'
LANGUAGE 'PLPGSQL';

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message jack 2003-03-09 05:42:18 Re: pl/pgsql how to return multiple values from a function
Previous Message daniel alvarez 2003-03-08 23:21:37 Re: Atomicity of UPDATE, interchanging values in unique