User`s guide

6 Using Database Toolbox Functions
6-6
Run the SQL script file named salesvolume.sql using the runsqlscript function.
results = runsqlscript(conn,'salesvolume.sql')
results =
Attributes: []
Data: {6x13 cell}
DatabaseObject: [1x1 database]
RowLimit: 0
SQLQuery: 'SELECT salesvolume.January , salesvolume.February , salesvolume.March , salesv...'
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]
results contains a cursor array with the returned data from running the SQL query in
the SQL script file.
Display the data in the cursor object containing the returned data.
results(1).Data
ans =
Columns 1 through 8
[5000.00] [3500.00] [2800.00] [2300.00] [1700.00] [1400.00] [1000.00] [900.00]
[2400.00] [1721.00] [1414.00] [1191.00] [ 983.00] [ 825.00] [ 731.00] [653.00]
[1200.00] [ 900.00] [ 800.00] [ 500.00] [ 399.00] [ 345.00] [ 300.00] [175.00]
...
Columns 9 through 13
[1600.00] [3300.00] [12000.00] [20000.00] 'United States'
[ 723.00] [ 790.00] [ 1400.00] [ 5000.00] 'United States'
[ 760.00] [1500.00] [ 5500.00] [17000.00] 'United States'
...
Display the column names for the returned data.
columnnames(results(1))
ans =
'January','February','March','April','May','June','July','August',...
'September','October','November','December','Country'
Close the Database Connection
Close the cursor array and database connection.
close(results)