User`s guide
fetch
7-141
ans =
'Victorian Doll'
'Train Set'
'Engine Kit'
'Painting Set'
'Space Cruiser'
'Building Blocks'
'Tin Soldier'
'Sail Boat'
'Slinky'
'Teddy Bear'
After finishing with the cursor object, close it.
close(curs)
Import All Data Using the Cursor Object
Working with the dbtoolboxdemo data source, use exec to select data in column City
in the table suppliers. Then, use fetch to import all data from the SQL statement into
the cursor object curs, and store the data in a cell array contained in the cursor object
property curs.Data.
curs = exec(conn,'select City from suppliers');
curs = fetch(curs)
curs =
Attributes: []
Data: {10x1 cell}
DatabaseObject: [1x1 database]
RowLimit: 0
SQLQuery: 'select City from suppliers'
Message: []
Type: 'Database Cursor Object'
ResultSet: [1x1 sun.jdbc.odbc.JdbcOdbcResultSet]
Cursor: [1x1 com.mathworks.toolbox.database.sqlExec]
Statement: [1x1 sun.jdbc.odbc.JdbcOdbcStatement]
Fetch: [1x1 com.mathworks.toolbox.database.fetchTheData]
View the contents of the Data element in the cursor object.
curs.Data
ans =
'New York'