(Not recommended) Import data into MATLAB workspace from database cursor
The fetch function with the cursor object is not recommended. Use the fetch function with the connection object or the select function instead. For details, see Compatibility Considerations.
The scrollable cursor functionality has no replacement.
imports all rows of data from an executed SQL query into the curs = fetch(curs)Data
property of the cursor object. Use the cursor object to investigate imported data and its structure.
Caution:
Leaving cursor and connection objects open or overwriting open objects can result in
unexpected behavior. After you finish working with these objects, you must close them
using close.
specifies options using one or more name-value pair arguments in addition to the input
arguments in previous syntaxes. For example, curs = fetch(___,Name,Value)curs =
fetch(curs,'AbsolutePosition',5); imports data using an absolute position offset
in a scrollable cursor, whereas curs = fetch(curs,'RelativePosition',10);
imports data using a relative position offset.
If you have a native ODBC connection that you established using
database, then running fetch on the cursor object updates the input cursor object itself. Depending on whether you provide an output argument,
the same object gets copied over to the output. Therefore, only one cursor object exists in memory for any of these usages:
% First use curs = fetch(curs) % Second use fetch(curs) % Third use curs2 = fetch(curs)