pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jack <datactrl@tpg.com.au>
To: pgsql-sql@postgresql.org
Subject: pl/pgsql how to return multiple values from a function
Date: Sun, 9 Mar 2003 13:33:44 +1000
Message-ID: <000901c2e5ec$b1411430$1400a8c0@jac> (raw)

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';





view thread (6+ messages)  latest in thread

Message-ID: <000901c2e5ec$b1411430$1400a8c0@jac>
Permalink:  ../000901c2e5ec$b1411430$1400a8c0@jac/
Also on:    postgresql.org/message-id/000901c2e5ec$b1411430$1400a8c0@jac

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: datactrl@tpg.com.au
  Subject: Re: pl/pgsql how to return multiple values from a function
  In-Reply-To: <000901c2e5ec$b1411430$1400a8c0@jac>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox