Re: Fetching rows from a cursor returned by a stored function

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Fetching rows from a cursor returned by a stored function
Дата
Msg-id 414B6B45.20900@opencloud.com
обсуждение исходный текст
Ответ на Fetching rows from a cursor returned by a stored function  (James Ireland <james@halfcab.com>)
Ответы Re: Fetching rows from a cursor returned by a stored function
Список pgsql-jdbc
James Ireland wrote:
> Hi everybody
>
> I have a stored function that returns a large number of rows as a
> cursor.  I am trying to prevent the entire result set being returned at
> once.  The code fragment below hits an OutOfMemoryError on the
> "while(resultSet.next())" line, which I believe is for this reason.

Unfortunately the current driver does not support cursor-based retrieval
for functions that return refcursors: it grabs the whole resultset at
once when the refcursor is retrieved as Types.OTHER.

If you don't mind the ugliness, you could register the result parameter
as Types.VARCHAR; that will give you a cursor name that you can then use
to execute FETCH queries yourself.

It might even work to execute FETCH FORWARD ALL for the cursor with a
non-zero fetchsize (and let the driver manage incremental fetches) but
I'm not sure what the behaviour of a non-zero row limit on a FETCH query
is at the protocol level..

-O

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: James Ireland
Дата:
Сообщение: Fetching rows from a cursor returned by a stored function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Fetching rows from a cursor returned by a stored function