One notable limitation of the current support for a
ResultSet
created from a
refcursor is that even though it is a cursor
backed ResultSet
, all data will be retrieved
and cached on the client. The Statement
fetch size parameter described in
the section called “Getting results based on a cursor” is ignored. This limitation
is a deficiency of the JDBC driver,
not the server, and it is technically possible to remove it,
we just haven't found the time.
It is also possible to treat the refcursor
return value as a cursor name directly. To do this, use the
getString
of ResultSet
.
With the underlying cursor name, you are free to directly use cursor
commands on it, such as FETCH
and
MOVE
.
Example 6.4. Treating refcursor as a cursor name
conn.setAutoCommit(false); CallableStatement proc = conn.prepareCall("{ ? = call refcursorfunc() }"); proc.registerOutParameter(1, Types.OTHER); proc.execute(); String cursorName = proc.getString(1); proc.close();