MATLAB DATABASE TOOLBOX RELEASE NOTES Uživatelská příručka Strana 643

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 684
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 642
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
Zobrazit stránku 642
1 2 ... 638 639 640 641 642 643 644 645 646 647 648 ... 683 684

Komentáře k této Příručce

Žádné komentáře