The Result Data Newsletter   
Volume 702 - February 2007   
© Copyright 2007 Result Data Consulting, Ltd.  614-505-0770  www.resultdata.com   

    Result Data Home Page  |  Newsletter Archive  |  Upcoming Events  |  Classes & Workshops  |  Request Information
Upcoming Events: 3/23: SQL Server User's Group, 4/11: Business Objects Seminar, 5/2: MOBOUG

Return to Newsletter Contents

 

Data Integrator:  Using Stored Procedures

by: Tom Hinkle, Consultant, CRCP, Data Integrator Instructor

Overview

Stored Procedures are not part of the Data Integrator class curriculum and are mentioned in the reference material, but not a lot of detail is provided.  You are able to call a database stored procedure anywhere that a SQL statement can be written.  However, depending on what that stored procedure does and whether it has output parameters will determine exactly where it can be used.

In one of the few references to stored procedures in the class manual, Lesson 5 under Pushed-down operations to the database, you will find the following note:

            Not all operations can be combined into single requests.

For example, when a stored procedure contains a COMMIT statement or does not return a value, you cannot combine the stored procedure SQL with the SQL for other operations in a query.  You can only push operations supported by the DBMS down to that DBMS.

More information about using stored procedures can be found in the Data Integrator Reference Guide, Chapter 6 Functions and Procedures.

Importing Stored Procedures

Before Data Integrator can call a procedure it must be imported to the datastore.  This is done by right clicking the datastore in the Datastores tab.  Select Import By Name.  You will see the Import By Name dialog box.  Click the drop down arrow to the right of the Type label.  Select Function, enter the procedure name and verify the owner is correct, then click the OK button.  After a short delay you can expand the datastore list and expand the Function list to see the function name displayed.  Double click the function name and it will open a properties page and you will see a list of input and output parameters.

Calling Stored Procedures

Here is an example of how you could use a stored procedure from a SQL Server 2000 database.  This procedure generates a primary key used in a Company table and also writes that number to a control table to store the next available id for the application to use.  If you try placing the procedure in the mapping clause it will fail. Because it returns a value you cannot include the mapping SQL needed.  Using the following method will enable you to use the stored procedure with satisfactory results. Use a Template table for the target table and create a new output column with the return parameter.

To do this, create the datastore and place the source table and query transform in the workspace.  Place a template table as your target and connect the objects.  Open the query transform and map the desired in and out columns.  To add the function, right click on the output list and select New Function Call.  Select Insert Above or Insert Below, the Function Wizard will appear. Select the datastore name from the list on the left and you will notice the function names in the right list.  Select the function (procedure) you want and click the Next button.  You will now see a list of the input parameters.  Enter the parameters and click Next.  The Select Output Parameters window appears.  Select the AL_SP_RETURN parameters and use the > button to move it to the right box or Drag it into the right box.  Double click the name under the Column in query column to change the name.  Click Finish and it will be added to the Schema Out list.  The Query Transform sample window above displays the result.

To use this value as the Company ID create another dataflow using the Template table from the previous dataflow as your source table.  Add a Query transform and the Company table as the target.  Mapping the columns from the source to the target and deleting the unneeded output columns finish the dataflow.  Run the job and view the result.  Data Integrator inserted the new rows to the Company table and the next person to use the application will have the correct new ID available.

Note: Using stored procedures will require some testing in Data Integrator and knowledge of the procedure operation is needed.  You may find the following discussion forum very helpful when researching difficult Business Objects topics:  www.forumtopics.com/busobj.  You will find a discussion on Data Integrator and some helpful threads.

Go to Top  |  Return to Newsletter Contents

 

The Result Data Newsletter is published approximately once a month to share the latest information on business intelligence, data management and CRM. There should be a link below to allow you to change or remove yourself from our list. We take your requests very seriously. If you have any difficulty please contact us at 614-505-0770 and we will make sure that your request is handled properly. This is not intended to be an unsolicited message and you can reach us in person if needed.

© Copyright 2007 Result Data Consulting, Ltd. - All Rights Reserved
All trademarks and copyrights are the property of their respective owners. This information is provided without warranty.
Announcements
Implementing XI R2 Business Views Class in May
If you need to create Business Views in BusinessObjects Enterprise XI, you need to attend this class.  BusinessObjects XI R2: Implementing Business Views will be held May 21/22 and is guaranteed to run.

Click on the class name to get additional  information or to register.
Next Business Objects BI Seminar
The next free Business Objects seminar on is April 11th, 2007.  Call 614-505-0770 or click here to reserve your seat.
New SQL Server User Group
Result Data and Babbage-Simmel are working together with Microsoft to resurrect the SQL Server User Group.  Our next meeting will be held on March 23rd from 1:00 to 3:30 at the Microsoft Polaris office.  Seating is limited and registration is requested.  Click here to register.
Private Training Classes & Mentoring
Ask us about our private classes and mentoring services and how they can help your team get up the curve fast. 
Next MOBOUG Meeting
The next Mid-Ohio Business Objects User Group (MOBOUG) meeting is May 2nd, 2007.  Call 614-505-0770 or click here to reserve your seat.
Looking for a Few Good Men and Women
Join our award winning team of Business Intelligence consultants and .Net Software developers.

Send your resume and salary requirements to:
jobs@resultdata.com