Can I use nested statements with the Database Toolbox?

I am trying to connect to a database and run a nested query using the Database Toolbox.
An example of the type of query I wish to run is as follows:
select x*y, y*z
from (
select x, y, z
from database
)
Is this possible?

 Accepted Answer

This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, please read below for any possible workarounds:
In general, any valid SQL statement (nested statements included) are valid using the EXEC function of the Database Toolbox.
For example:
conn = database('datasourcename', 'username', 'password')
curs = exec(conn, 'select x*y, y*z from ( select x, y, z from database )' )

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!