Database Toolbox | ![]() ![]() |
Get catalog's stored procedures
Syntax
p = procedures(dbmeta, 'cata') p = procedures(dbmeta, 'cata', 'sch')
Description
p = procedures(dbmeta, 'cata')
returns the stored procedures in the catalog cata
, for the database whose database metadata object is dbmeta
, which was created using dmd
.
p = procedures(dbmeta, 'cata', 'sch')
returns the stored procedures in the schema sch
, of the catalog cata
, for the database whose database metadata object is dbmeta
, which was created using dmd
.
Stored procedures are SQL statements that are saved with the database. You can use the exec
function to run a stored procedure, providing the stored procedure as the sqlquery
argument instead of actually entering the sqlquery
statement as the argument.
Examples
p = procedures(dbmeta,'DBA')
where dbmeta
is the database metadata object and the catalog is DBA
. MATLAB returns the names of the stored procedures
p = 'sp_contacts' 'sp_customer_list' 'sp_customer_products' 'sp_product_info' 'sp_retrieve_contacts' 'sp_sales_order'
Execute the stored procedure sp_customer_list
for the database connection conn
and fetch all of the data. Type
curs = exec(conn,'sp_customer_list'); curs = fetch(conn)
curs = Attributes:[] Data:{10x2 cell} DatabaseObject:[1x1 database] RowLimit:0 SQLQuery:'sp_customer_list' 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]
curs.Data
ans = [101] 'The Power Group' [102] 'AMF Corp.' [103] 'Darling Associates' [104] 'P.S.C.' [105] 'Amo & Sons' [106] 'Ralston Inc.' [107] 'The Home Club' [108] 'Raleigh Co.' [109] 'Newton Ent.' [110] 'The Pep Squad'
See Also
dmd
, exec
, get
, procedurecolumns
![]() | procedurecolumns | querybuilder | ![]() |