Returning just one resultset from function call with refcursor return

Поиск
Список
Период
Сортировка
От Francisco Figueiredo Jr.
Тема Returning just one resultset from function call with refcursor return
Дата
Msg-id 414F60C2.7030506@yahoo.com.br
обсуждение исходный текст
Ответы Re: Returning just one resultset from function call with refcursor
Список 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 по дате отправления:

Предыдущее
От: "Francisco Figueiredo Jr."
Дата:
Сообщение: Re: Issues regarding code license of ported code.
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: Returning just one resultset from function call with refcursor