MATLAB DATABASE TOOLBOX RELEASE NOTES Guide de l'utilisateur Page 643

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 684
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 642
1 2 ... 638 639 640 641 642 643 644 645 646 647 648 ... 683 684

Commentaires sur ces manuels

Pas de commentaire