MATLAB DATABASE TOOLBOX RELEASE NOTES Guide de l'utilisateur Page 385

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 684
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 384
Call a Stored Procedure That Returns Data
6-43
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 com.microsoft.sqlserver.jdbc.SQLServerConnection]
TimeOut: 0
AutoCommit: 'on'
Type: 'Database Object'
database returns conn, a connection Database Object for the 'test_db' database.
Alternatively, you can use the native ODBC interface for an ODBC connection. For
details, see database.
Call the Stored Procedure
To return the result set in table format, use setdbprefs to set 'DataReturnFormat'
to 'table'.
setdbprefs('DataReturnFormat','table')
Call the stored procedure, getSupplierInfo, to return supplier information for the city
of New York using exec with conn.
sqlquery = '{call getSupplierInfo(''New York'')}';
curs = exec(conn,sqlquery)
curs =
Attributes: []
Data: 0
DatabaseObject: [1x1 database]
RowLimit: 0
SQLQuery: '{call getSupplierInfo('New York')}'
Message: []
Type: 'Database Cursor Object'
ResultSet: [1x1 com.microsoft.sqlserver.jdbc.SQLServerResultSet]
Cursor: [1x1 com.mathworks.toolbox.database.sqlExec]
Statement: [1x1 com.microsoft.sqlserver.jdbc.SQLServerStatement]
Fetch: 0
exec returns a Database Cursor Object, curs, containing the supplier information.
Retrieve Output Data from the Stored Procedure
Retrieve supplier data from curs using fetch.
Vue de la page 384
1 2 ... 380 381 382 383 384 385 386 387 388 389 390 ... 683 684

Commentaires sur ces manuels

Pas de commentaire