MATLAB DATABASE TOOLBOX RELEASE NOTES Guia do Utilizador Página 641

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 684
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 640
runstoredprocedure
7-211
Close the database connection conn.
close(conn)
Call a Stored Procedure with Output Arguments
Define a stored procedure named maxDecVolume that selects the maximum sales volume
in December by executing this code. This procedure has one output argument data and
no input arguments. This code assumes you are using a Microsoft SQL Server database.
CREATE PROCEDURE maxDecVolume
@data int OUTPUT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT @data = max(December) from salesVolume
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 using:
Database connection conn
Stored procedure maxDecVolume
Empty brackets to denote no input arguments
Numeric Java data type outputtype
outputtype = {java.sql.Types.NUMERIC};
results = runstoredprocedure(conn,'maxDecVolume',[],outputtype)
results =
[1x1 java.math.BigDecimal]
results returns a cell array that contains the maximum sales volume as a Java decimal
data type.
Display the value in results.
Vista de página 640
1 2 ... 636 637 638 639 640 641 642 643 644 645 646 ... 683 684

Comentários a estes Manuais

Sem comentários