CURSOR and REF CURSOR as a JDBC data type
Support for REF CURSORS was added in Java 8/JDBC 4.2. Use the type Types.REF_CURSOR
for cursor return types. They can be iterated through the ResultSet
interface. Example:
CallableStatement cstmt = conn.prepareCall("{callmySproc(?)}");cstmt.registerOutParameter(1, Types.REF_CURSOR);cstmt.executeQuery();ResultSet cursor = cstmt.getObject(1, ResultSet.class);while(cursor.next()) { System.out.println("Name = " + cursor.getString(1));}