| Database Toolbox™ | ![]() |
results = runstoredprocedure(conn, sp_name, parms_in,
types_out)
results = runstoredprocedure(conn, sp_name, parms_in, types_out) calls a stored procedure with specified input parameters and returns output parameters, where:
conn is the database connection handle
sp_name is the stored procedure to run
parms_in is a cell array containing the input parameters for the stored procedure
types_out is the list of data types of the output parameters
Use runstoredprocedure to return the value of a variable to a MATLAB® variable, which you cannot do when running a stored procedure via exec. Running a stored procedure via exec returns resultsets but cannot return output parameters.
These examples illustrate how runstoredprocedure differs from running stored procedures via exec.
The command:
x = runstoredprocedure(c,'myprocnoparams')
Runs a stored procedure that has no input or output parameters.
The command:
x = runstoredprocedure(c,'myprocinonly',{2500,'Jones'}) Runs a stored procedure given input parameters 2500 and 'Jones'. It returns no output parameters.
The command:
x = runstoredprocedure(c,'myproc',{2500,'Jones'},{java.sql.Types.NUMERIC})Runs the stored procedure myproc given input parameters 2500 and 'Jones'. It returns an output parameter of type java.sql.Types.NUMERIC, which could be any numeric Sun™ Java™ data type. The output parameter x is the value of a database variable n. The stored procedure myproc creates this variable, given the input values 2500 and 'Jones'. For example, myproc computes n, the number of days when Jones is 2500. It then returns the value of n to x.
![]() | rsmd | set | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |