User`s guide
fetch
7-147
close(curs)
Import Data with Different Formats Using the Cursor Object
Import data that includes a BOOLEAN field, using the setdbprefs function to specify
cellarray as the format for the retrieved data.
curs = exec(conn,['select InvoiceNumber, '...
'Paid from Invoice']);
setdbprefs('DataReturnFormat','cellarray')
curs = fetch(curs,5);
A = curs.Data
A =
[ 2101] [0]
[ 3546] [1]
[33116] [1]
[34155] [0]
[34267] [1]
View the class of the second column of A.
class(A{1,2})
ans =
logical
After finishing with the cursor object, close it.
close(curs)
Import Data Using the Database Connection Object
fetch imports data from the specified SQL statement when you pass a database object,
conn, as the first argument. Use this example when using a JDBC/ODBC bridge or a
JDBC interface. For the native ODBC interface, use curs as the input argument.
Using the dbtoolboxdemo data source that you access using the database connection
object, conn, import the productDescription column from productTable. Set the
data return format to 'cellarray' using setdbprefs.
setdbprefs('DataReturnFormat','cellarray')