User`s guide
runstoredprocedure
7-213
[1x1 java.math.BigDecimal]
results is a cell array that contains the supplier count as a Java decimal data type.
Display the value in results.
results{1}
ans =
6.0000
There are six suppliers in New York.
Close the database connection conn.
close(conn)
Call a Stored Procedure with Multiple Input and Output Arguments
Define a stored procedure named productsWithinUnitCost that returns the
product number and description for products that have a unit cost in a specified
range by executing this code. This procedure has two input arguments minUnitCost
and maxUnitCost. This procedure has two output arguments productno and
productdesc. This code assumes you are using a Microsoft SQL Server database.
CREATE PROCEDURE productsWithinUnitCost
(@minUnitCost INT,
@maxUnitCost INT,
@productno INT OUTPUT,
@productdesc VARCHAR(50) OUTPUT)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
select @productno = productNumber, @productdesc = productDescription
from productTable
where unitCost > @minUnitCost and unitCost < @maxUnitCost
END