User`s guide

7 Functions — Alphabetical List
7-148
sqlquery = 'select productdescription from productTable';
results = fetch(conn, sqlquery)
results =
'Victorian Doll'
'Train Set'
'Engine Kit'
'Painting Set'
'Space Cruiser'
'Building Blocks'
'Tin Soldier'
'Sail Boat'
'Slinky'
'Teddy Bear'
View the size of the cell array into which the results were returned.
size(results)
ans =
10 1
Close the database connection.
close(conn)
Import Data with fetchbatchsize 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 the productTable by
using the fetchbatchsize argument.
setdbprefs('DataReturnFormat','cellarray')
sqlquery = 'select productdescription from productTable';
fetchbatchsize = 5;
results = fetch(conn,sqlquery,fetchbatchsize);