Example That Uses Client-Side Cursors - Aster Client

Teradata Aster® Client Guide

Product
Aster Client
Release Number
7.00
Published
May 2017
Language
English (United States)
Last Update
2018-04-13
dita:mapPath
hki1475000360386.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
B700-2005
lifecycle
previous
Product Category
Software

Assuming a Connection conn, you can set the FetchSize like this:

// Remember the current autocommit state
boolean autoCommit = conn.getAutoCommit();
// Make sure autocommit is off
conn.setAutoCommit(false);
Statement st = conn.createStatement();
// Turn use of the cursor on by setting FetchSize, expressed in rows
st.setFetchSize(50);
ResultSet rs = st.executeQuery("SELECT * FROM mytable");
// Set the autocommit state back
conn.setAutoCommit(autoCommit);
while (rs.next()) {
System.out.print("a row was returned.");
}
rs.close();
// Close the statement.
st.close();