User`s guide
setdbprefs
7-229
Specify the report format for the ErrorHandling preference.
setdbprefs('ErrorHandling','report')
With the ErrorHandling property set to report, errors generated by running
database or exec appear immediately in the Command Window.
Fetch data from a closed cursor.
curs = exec(conn,'select productdescription from producttable');
close(curs)
curs = fetch(curs,3);
Error using cursor/fetch>errorhandling (line 491)
Invalid fetch cursor.
Error in cursor/fetch (line 460)
errorhandling(outCursor.Message);
The error generated by this operation appears immediately in the Command Window.
Specify the empty format for the ErrorHandling preference.
setdbprefs('ErrorHandling','empty')
With the ErrorHandling property set to empty, errors generated while running
database or exec are stored in the Message field of the returned connection or cursor
object. In addition, objects that cannot be created are returned as empty handles, [].
Fetch data from a cursor from an invalid table invalidTable.
curs = exec(conn, 'select * from invalidTable')
curs = fetch(curs)
curs =
Attributes: []
Data: []
DatabaseObject: [1x1 database]
RowLimit: 0
SQLQuery: 'select * from invalidTable'
Message: [1x102 char]
Type: 'Database Cursor Object'
ResultSet: 0
Cursor: 0