User`s guide
7 Functions — Alphabetical List
7-214
GO
Create a Microsoft SQL Server database connection conn using the JDBC driver. For
details, see “Connecting to a Database”. Then, call the stored procedure using:
• Database connection conn
• Stored procedure productsWithinUnitCost
• Input arguments inputargs to specify a unit cost between 19 and 21
• Output Java data types outputtypes to specify numeric and string data types for
product number and description
inputargs = {19,21};
outputtypes = {java.sql.Types.NUMERIC,java.sql.Types.VARCHAR};
results = runstoredprocedure(conn,'productsWithinUnitCost',...
inputargs,outputtypes)
results =
[1x1 java.math.BigDecimal]
'Snacks'
results returns a cell array that contains the product number as a Java decimal data
type and the product description as a string.
Display the product number in results.
results{1}
ans =
15
The product with product number 15 has a unit cost between 19 and 21.
Display the product description in results.
results{2}
ans =
Snacks
The product with product number 15 has the product description Snacks.