User`s guide

Selecting Data
2-195
Selecting Data
In this section...
“Use Database Explorer to Select Data” on page 2-195
“Use the Command Line to Select Data” on page 2-195
“Working with Custom Data Types” on page 2-195
“Running SQL Queries Saved in Scripts or Files” on page 2-196
You can open two different connections to the same database, one using Database
Explorer and another using the command line. If you are working with large data sets,
use the command line instead of Database Explorer for maximum performance.
Use Database Explorer to Select Data
If you have minimal proficiency writing SQL queries or want to quickly browse the data
in your database, use Database Explorer. To build queries using Database Explorer, see
“Refine Results Using Query Criteria and Rules”.
Use the Command Line to Select Data
Exploring your database data using the command line requires knowledge of writing
SQL queries to perform the selection. Use the exec and fetch functions to select data
from your database. The exec function executes your SQL statement and the fetch
function retrieves the data from the database into a MATLAB variable. If you are not
comfortable with writing SQL, then use Database Explorer to select data from your
database.
If you have a stored procedure you want to run using Database Toolbox, you can use the
runstoredprocedure or exec function.
Working with Custom Data Types
Database Toolbox functions return custom data types, for example Oracle ref cursors, as
Java objects. You can manually parse these objects to retrieve their data contents. Use
the methods function to access all the methods of your Java object. Use the available
methods to retrieve data from your Java object. The steps for your object are specific to
your database. For details, refer to your JDBC driver or database-specific documentation.