From: Oliver Jowett <oliver@opencloud.com>
To: James Ireland <james@halfcab.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Fetching rows from a cursor returned by a stored function
Date: Sat, 18 Sep 2004 10:55:01 +1200
Message-ID: <414B6B45.20900@opencloud.com> (raw)
In-Reply-To: <414AFFAD.6040404@halfcab.com>
References: <414AFFAD.6040404@halfcab.com>
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
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: oliver@opencloud.com, james@halfcab.com
Subject: Re: Fetching rows from a cursor returned by a stored function
In-Reply-To: <414B6B45.20900@opencloud.com>
References: <414AFFAD.6040404@halfcab.com> <414B6B45.20900@opencloud.com>
* 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