MATLAB: Can I specify a starting point to fetch data from a database using the Database Toolbox

Database Toolbox

I would like to specify a row number to the FETCH function to designate where data retrieval should start.

Best Answer

The ability to specify a starting record for the FETCH function is not available in Database Toolbox.
To work around this issue, use the ResultSet property of the cursor object that results from the EXEC call. For example, the following code can move the cursor 100 records into the result set without processing any data:
tmp = curs.ResultSet;
for i = 1:100
tmp.next;
end
where "curs" is the cursor returned after running an SQL query using the EXEC function.
After you run the above code, the next fetch call starts retrieving at record 101.