| Contents | Index |
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, for the database connection handle conn . sp_name is the stored procedure to run, parms_in is a cell array containing the input parameters for the stored procedure, and types_out is the list of data types for 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.
Run a stored procedure that has no input or output parameters:
x = runstoredprocedure(c,'myprocnoparams')
Run a stored procedure given input parameters 2500 and 'Jones' with no output parameters.
x = runstoredprocedure(c,'myprocinonly',{2500,'Jones'}) Run the stored procedure myproc given input parameters 2500 and 'Jones'. Return 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.
x = runstoredprocedure(c,'myproc',{2500,'Jones'},{java.sql.Types.NUMERIC})

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |