User`s guide
7 Functions — Alphabetical List
7-212
results{1}
ans =
35000
The maximum sales volume in December is 35,000.
Close the database connection conn.
close(conn)
Call a Stored Procedure with Input and Output Arguments
Define a stored procedure named getSuppCount that counts the number of suppliers for
a specified city by executing this code. This procedure has one input argument cityName
and one output argument suppCount. This code assumes you are using a Microsoft SQL
Server database.
CREATE PROCEDURE getSuppCount
(@cityName varchar(20),
@suppCount int OUTPUT)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT @suppCount = count(supplierNumber)
from suppliers where City = @cityName;
END
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 getSuppCount
using the database connection conn. The input argument inputarg is a cell array
containing the string 'New York'. The output Java data type outputtype is numeric.
inputarg = {'New York'};
outputtype = {java.sql.Types.NUMERIC};
results = runstoredprocedure(conn,'getSuppCount',inputarg,outputtype)
results =