Versions Compared
Version | Old Version 3 | New Version 4 |
---|---|---|
Changes made by | ||
Saved on |
Key
- This line was added.
- This line was removed.
- Formatting was changed.
A stored procedure is a group of SQL statements that form a logical unit and perform a particular task. Stored procedures are used to encapsulate a set of operations or queries to execute on a database server. Stored procedures can be compiled and executed with different parameters and they may have any combination of input, output, and input/output parameters.
Prerequisites
- Database Info activity must be created before creating Stored Procedure activity.
Steps to set the values of IN or INOUT parameters using put-context-var:
Connect the put-context-var action to this activity.
Image Removed
Connect Put-Context-Var to activity
Right-click put-context-var and select View Properties.
Its properties are displayed in the Properties Panel in the Bottom Pane.
Image RemovedProperties of Put-Context-Var
Select the Stored Procedure activity from the Activity Name dropdown list.
As you select store procedure activity name in the put-context-var, then two properties are displayed in the Variable Name dropdown list.
Select the IN or INOUT parameter from Variable Name dropdown list.
After selecting a variable, you need to edit this variable by adding ".<<variableName>>".
Image Removed
Context Variable Details for Defining Parameters
Give the value of the parameter in Variable Value text box.
Image Removed
Context Variable Details for Defining Parameter Values
Save the process flow and exit from Process Designer.
You can also set this input variable using a Process flow Variable or a custom plugin.
For Custom plugin and Process flow variable, if the selected stored procedure has IN parameters as empid, you have to set an input variable with the name Service.<ActivityName>.InParams.empid, where <Activity Name> is the name of the stored procedure activity, which is used in the process flow.
The variable name for INOUT parameter will be Service.<ActivityName>.InOutParams.count, where <Activity Name> is the name of the activity, which is used to execute the process flow and count is the INOUT parameter of the stored procedure.
Similarly, OUT parameters of the stored procedure are set to process flow context. For example, if the selected stored procedure has OUT parameters as salary, the output variable is set in the process flow context as Service.<ActivityName>.OutParams.salary, where <Activity Name> is the name of the activity, which is used to execute the process flow. You can further use this variable and its value is the process flow. Value of output variable set by stored procedure activity is always in string format. You need to type cast it in a required format. The stored procedure doesn't generate a stream. Therefore, you have to use context source activity after stored procedure activity. To know how to create a context source, refer to the section Using Context Source and Context Target.
Steps to create Stored Procedure activity
Go to Services > Miscellaneous and then click Stored Procedure.
The Manage Stored Procedure screen is displayed (see Figure 617).
Image Removed
Manage Stored Procedure
Click the Create New link. The Create Stored Procedure screen is displayed.
Image Removed
Create Stored Procedure
Steps to create Stored Procedure activity:
Click Configure > OTHERS > Stored Procedure.
Click Create Stored Procedure.
- Enter the name and description for new stored procedure activity in the textbox Name and Description respectively.
Select the database info the database info activity from the dropdown list Database Info Id.To Database Info drop-down list .
, refer to the section ..Info Click here to learn how to create Database Info activity
Creating Database Info of the Administrator Guide.. To select the database stored procedure, click the Browse button. The Select Stored Procedure screen with the list of stored procedures is displayed.
Image Removed
Select Stored Procedure
Image AddedInfo Make sure that you have execute permissions on the database. As, only the procedures for which the database user has permission are shown on the Browse screen. Select the required stored procedure and click the Get Parameters button. The Stored Procedure Parameter screen is displayed with list of parameters.
Image Removed
View Parameters
Click OK to return to the Stored Procedure activity screen. Parameters of the selected procedure are populated in Stored Procedure Parameters field.
Image Removed
Manage Stored ProcedureThe variables The variables are automatically populated in the populated in the In Params, Out Params, and InOut Params fields, these fields are editable though. The @ symbol precedes the variable name in case of MS SQL database, however, for Oracle database @ symbol is not required.
In the Stored Procedure activity screen click the Save- buttonExpand the Advanced Properties section and select the Project from Project drop-down list.
- Click Save.
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
Panel | ||||
---|---|---|---|---|
| ||||
Creating Context Upload Activity Creating Context Download Activity |