Returning just one resultset from function call with refcursor return - Mailing list pgsql-jdbc

From Francisco Figueiredo Jr.
Subject Returning just one resultset from function call with refcursor return
Date
Msg-id 414F60C2.7030506@yahoo.com.br
Whole thread Raw
Responses Re: Returning just one resultset from function call with refcursor  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc

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.


pgsql-jdbc by date:

Previous
From: "Francisco Figueiredo Jr."
Date:
Subject: Re: Issues regarding code license of ported code.
Next
From: Oliver Jowett
Date:
Subject: Re: Returning just one resultset from function call with refcursor