Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Stored Procedure Transformation Overview

Stored Procedure Transformation Overview

Ratings: (0)|Views: 2,194|Likes:
Published by ypraju

More info:

Published by: ypraju on Dec 21, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Stored Procedure Transformation Overview 
By PebchalaRaju.Yanamala
Transformation type:
PassiveConnected/UnconnectedA Stored Procedure transformation is an important tool for populating andmaintaining databases. Database administrators create stored procedures toautomate tasks that are too complicated for standard SQL statements.A stored procedure is a precompiled collection of Transact-SQL, PL-SQL or other database procedural statements and optional flow control statements, similar toan executable script. Stored procedures are stored and run within the database.You can run a stored procedure with the EXECUTE SQL statement in adatabase client tool, just as you can run SQL statements. Unlike standard SQL,however, stored procedures allow user-defined variables, conditional statements,and other powerful programming features.Not all databases support stored procedures, and stored procedure syntax variesdepending on the database. You might use stored procedures to complete thefollowing tasks:Check the status of a target database before loading data into it.Determine if enough space exists in a database.Perform a specialized calculation.Drop and recreate indexes.Database developers and programmers use stored procedures for various taskswithin databases, since stored procedures allow greater flexibility than SQLstatements. Stored procedures also provide error handling and loggingnecessary for critical tasks. Developers create stored procedures in the databaseusing the client tools provided with the database.The stored procedure must exist in the database before creating a StoredProcedure transformation, and the stored procedure can exist in a source, target,or any database with a valid connection to the Integration Service.You might use a stored procedure to perform a query or calculation that youwould otherwise make part of a mapping. For example, if you already have awell-tested stored procedure for calculating sales tax, you can perform thatcalculation through the stored procedure instead of recreating the samecalculation in an Expression transformation.
Input and Output Data
One of the most useful features of stored procedures is the ability to send data tothe stored procedure, and receive data from the stored procedure. There arethree types of data that pass between the Integration Service and the storedprocedure:Input/output parameters
Return valuesStatus codesSome limitations exist on passing data, depending on the databaseimplementation, which are discussed throughout this chapter. Additionally, not allstored procedures send and receive data. For example, if you write a storedprocedure to rebuild a database index at the end of a session, you cannotreceive data, since the session has already finished.
Input/Output Parameters
For many stored procedures, you provide a value and receive a value in return.These values are known as input and output parameters. For example, a salestax calculation stored procedure can take a single input parameter, such as theprice of an item. After performing the calculation, the stored procedure returnstwo output parameters, the amount of tax, and the total cost of the item includingthe tax.The Stored Procedure transformation sends and receives input and outputparameters using ports, variables, or by entering a value in an expression, suchas 10 or SALES.
Return Values
Most databases provide a return value after running a stored procedure.Depending on the database implementation, this value can either be user-definable, which means that it can act similar to a single output parameter, or itmay only return an integer value.The Stored Procedure transformation captures return values in a similar manner as input/output parameters, depending on the method that the input/outputparameters are captured. In some instances, only a parameter or a return valuecan be captured.If a stored procedure returns a result set rather than a single return value, theStored Procedure transformation takes only the first value returned from theprocedure.
An Oracle stored function is similar to an Oracle stored procedure, exceptthat the stored function supports output parameters or return values. In thischapter, any statements regarding stored procedures also apply to storedfunctions, unless otherwise noted.
Status Codes
Status codes provide error handling for the Integration Service during a workflow.The stored procedure issues a status code that notifies whether or not the storedprocedure completed successfully. You cannot see this value. The IntegrationService uses it to determine whether to continue running the session or stop. Youconfigure options in the Workflow Manager to continue or stop the session in theevent of a stored procedure error.
Connected and Unconnected
Stored procedures run in either connected or unconnected mode. The mode youuse depends on what the stored procedure does and how you plan to use it in asession. You can configure connected and unconnected Stored Proceduretransformations in a mapping.
The flow of data through a mapping in connected mode alsopasses through the Stored Procedure transformation. All data entering thetransformation through the input ports affects the stored procedure. You shoulduse a connected Stored Procedure transformation when you need data from aninput port sent as an input parameter to the stored procedure, or the results of astored procedure sent as an output parameter to another transformation.
The unconnected Stored Procedure transformation is notconnected directly to the flow of the mapping. It either runs before or after thesession, or is called by an expression in another transformation in the mapping.The following table compares connected and unconnected transformations:If you want toUse this modeRun a stored procedure before or after a session.UnconnectedRun a stored procedure once during a mapping, such as pre- or post-session.UnconnectedRun a stored procedure every time a row passes through theStored Procedure transformation.Connected or UnconnectedRun a stored procedure based on data that passes through themapping, such as when a specific port does not contain a nullvalue.UnconnectedPass parameters to the stored procedure and receive a singleoutput parameter.Connected or UnconnectedPass parameters to the stored procedure and receive multipleoutput parameters.Note: To get multiple output parameters from an unconnectedStored Procedure transformation, you must create variables for each output parameter.Connected or UnconnectedRun nested stored procedures.UnconnectedCall multiple times within a mapping.UnconnectedRelated Topics:Configuring a Connected Transformation Configuring an Unconnected Transformation
Specifying when the Stored Procedure Runs
In addition to specifying the mode of the Stored Procedure transformation, youalso specify when it runs. In the case of the unconnected stored procedureabove, the Expression transformation references the stored procedure, whichmeans the stored procedure runs every time a row passes through theExpression transformation. However, if no transformation references the StoredProcedure transformation, you have the option to run the stored procedure oncebefore or after the session.The following list describes the options for running a Stored Proceduretransformation:

Activity (20)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
rrrdrigo liked this
madanmca2008 liked this
bbabapeer786 liked this
jayavardhankoti liked this
Pindiganti liked this
natrajdreams liked this
sruti_2003 liked this
Neerugattu liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->