User`s guide

Fetch Data Incrementally Using the Cursor Object
6-53
Size per row being retrieved
Java heap memory value
Driver’s default fetch size
System architecture
Hence, the optimal value can vary across sites.
If 'FetchInBatches' is set to 'yes' and the total number of rows fetched is less than
'FetchBatchSize', MATLAB shows a warning message and then fetches all the rows.
The message is: Batch size specified was larger than the number of rows
fetched.
Retrieve Data Using a Row Limit
You can set a row limit on the final output even when the FetchInBatches setting is
'yes'.
setdbprefs('FetchInBatches’,'yes')
setdbprefs('FetchBatchSize’,'2')
curs = exec(conn,'select * from productTable');
curs = fetch(curs,3);
A = curs.Data
A =
[9] [125970] [1003] [13] 'Victorian Doll'
[8] [212569] [1001] [ 5] 'Train Set'
[7] [389123] [1007] [16] 'Engine Kit'
In this case, fetch retrieves the first three rows of productTable, two rows at a time.
Close the Cursor Object
After finishing with the cursor object, close it.
close(curs)
See Also
database | exec | fetch | setdbprefs
More About
“Importing Data Using the fetch Function” on page 6-48