StoredProcedure (BIRT)

From Eclipsepedia

Revision as of 15:56, 29 January 2007 by Jweathersby.actuate.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Stored Procedure

This example demonstrates using a JDBC driver to call a stored procedure from MySQL. The Stored procedure takes two arguments. One is an input parameter and specifies what product name the stored procedure is executed for and returns the number of orders that included the given product. The second parameter is an output parameter and returns the count of total orders.
Add comments at the bottom of the example.

BIRT Version

BIRT 2.1.1

BIRT Report

StoredProcedureExample.zip sss

Source

Stored Procedure SQL

CREATE PROCEDURE OrdersByProductProc (IN Product varchar(50), OUT test int   )
BEGIN

SELECT count(*), productName FROM orderdetails, products WHERE orderdetails.productCode = products.productCode AND products.productName = Product GROUP BY   products.productName;
Select Count(*) INTO test FROM orderdetails;
END
GO

This procedure is called by using the following statement in the Data Set Editor for an SQL Stored Procedure Query.

{call OrdersByProductProc (?, ?)}

The example uses one data set to populate a dynamic parameter that is then passed to the second data set, which contains the stored procedure. The results of the stored procedure are presented in a table element. In the table footer the output parameter of the stored procedure is referenced as follows:

"Total Orders: " + outputParams["totalorders"]


Comments

Please enter comments below by selecting the edit icon to the right. You will need a Bugzilla account to add comments.