(To be removed) Run SQL script on database
The runsqlscript function will be removed in a future release.
Use the executeSQLScript function instead. For details, see Compatibility Considerations.
returns a results = runsqlscript(conn,scriptfile)cursor object array that contains a
cursor object for each executed SQL command in
the SQL script file scriptfile using the database connection. The
runsqlscript function executes all SQL commands in the SQL
script file.
specifies additional options using one or more name-value pair arguments. For
example, results = runsqlscript(___,Name,Value)'RowInc',5 returns results from the executed SQL
statements in the SQL script file in increments of five rows at a time.
Use runsqlscript to import data into MATLAB®, especially if you have long and complex SQL queries that are
difficult to convert into MATLAB character vectors or string scalars.
runsqlscript is not designed to handle SQL scripts
containing continuous PL/SQL blocks with BEGIN and
END, such as stored procedure definitions or trigger
definitions. However, table definitions do work.
An SQL script containing any of the following can produce unexpected results:
Apostrophes that are not escaped, including the ones in comments.
For example, write the character vector 'Here's the
code' as 'Here''s the code'.
Nested comments.
An SQL script containing more than 25,000 characters causes
runsqlscript to return an error.
Any values assigned to RowInc or
QTimeOut apply to all queries in the SQL script. For
example, if 'RowInc' is set to 5, then all
queries in the script return at most five rows in their respective query
results.
You can set preferences for the query results using the setdbprefs function. Preference
settings apply to all queries in the SQL script. For example, if the
'DataReturnFormat' is set to numeric, all query results
return as numeric matrices.
close | database | fetch | setdbprefs