From: Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
To: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Returning just one resultset from function call with refcursor return
Date: Mon, 20 Sep 2004 19:59:14 -0300
Message-ID: <414F60C2.7030506@yahoo.com.br> (raw)
Hi guys,
I'd like to know how you are doing to return a cursor resultset from
function call.
I know, from documentation, that I can do the following:
CREATE TABLE test (col text);
INSERT INTO test VALUES ('123');
CREATE FUNCTION reffunc(refcursor) RETURNS refcursor AS '
BEGIN
OPEN $1 FOR SELECT col FROM test;
RETURN $1;
END;
' LANGUAGE plpgsql;
BEGIN;
SELECT reffunc('funccursor');
FETCH ALL IN funccursor;
COMMIT;
The problem is that when I execute the lines above I get:
reffunc
------------
funccursor
(1 row)
col
-----
123
(1 row)
I'd like to omit the reffunc resultset return and get directly the col
resultset. Is this possible?
Thanks in advance.
Please, let me know if this is not the appropriated place to do such
questions.
Regards,
Francisco Figueiredo Jr.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: fxjrlists@yahoo.com.br
Subject: Re: Returning just one resultset from function call with refcursor return
In-Reply-To: <414F60C2.7030506@yahoo.com.br>
References: <414F60C2.7030506@yahoo.com.br>
* 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