User`s guide

runsqlscript
7-203
To get the file of SQL commands, navigate to \toolbox\database\dbdemos
\compare_sales.sql in your MATLAB root folder, or copy and paste the path into
your current working folder.
Create the connection object to the data source, dbtoolboxdemo.
conn = database('dbtoolboxdemo','','');
User names and passwords are not required for this connection.
Alternatively, you can use the native ODBC interface for an ODBC connection. For
details, see database.
Run the SQL script, compare_sales.sql, specifying two-row increments.
results = runsqlscript(conn,'compare_sales.sql','rowInc',2)
results =
1x2 array of cursor objects
The SQL script has two queries, and returns two results when executed.
Display the resultset returned for the second query.
results(2).Data
ans =
'Painting Set' 'Terrific Toys' 'London' [3000] [2400] [1800]
'Victorian Doll' 'Wacky Widgets' 'Adelaide' [1400] [1100] [ 981]
Only the first two rows of the results are returned.
Fetch the next increment of two rows.
res2 = fetch(results(2),2);
res2.Data
ans =
'Sail Boat' 'Incredible Machines' 'Dublin' [3000] [2400] [1500]
'Slinky' 'Doll's Galore' 'London' [3000] [1500] [1000]
Close the cursor arrays and connection.
close(results)