Versions Compared

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.
Limitation:

...

Anchor
OLE_LINK12
OLE_LINK12
This feature is available in:

Enterprise

Premier

Professional

Express

??

?

 



Prerequisites

  • Database Info activity must be created before creating Stored Procedure activity.



Using Adeptia Server's Stored Procedure activity, you can execute a database stored procedure. Stored Procedure activity takes IN parameters from process flow context. Therefore, you need to set the value of IN parameters in the process flow context. To do so, follow the steps below.
 

Steps to set the values of IN or INOUT parameters using put-context-var:

  1. Click hierarchy structure in the Repository View panel. Expand the Action list and select the put-context-var action and drag it to the Graph Canvas area just before the stored procedure activity.
  2. Connect the put-context-var action to this activity (see Figure 613).

    Image Modified

...

  1. Figure 613: Connect Put-Context-Var to activity

  2. Right-click put-context-var and select View Properties.

    Its properties are displayed in

...

  1. the Properties Panel in the Bottom Pane (see Figure 614).


    Image Modified

...


...

  1. Figure 614: Properties of Put-Context-Var

  2. Click the Edit button to edit the value of context variable. The Edit Context Variables dialog box is displayed.
  3. Click Add Variable ( Image Modified ) to add new context variable. The Context Variable Information screen is displayed.
  4. Select the Stored Procedure activity from the Activity Name dropdown list.

    Image Removed
    Info

    As you select store procedure activity name in the put-context-var, then two property are displayed in the Variable Name dropdown list.

  5. Select the IN or INOUT parameter from Variable Name dropdown list.

    Image Removed
    Info

    After selecting a variable, you need to edit this variable by adding ".<<variableName>>". (see figure below)

    Image Modified

    Anchor_Toc401308677_Toc401308677

    Figure 615: Context Variable Details for Defining Parameters

  6. Give the value of parameter in Variable Value textbox. The entered information is displayed as shown in Figure 114.

    Image Modified

...

  1. Figure 616: Context Variable Details for Defining Parameter Values

  2. Click Done to close the Context Variable Information screen. This takes the control back to the Edit Context Variables screen. The newly created variable is added to the list of existing context variables.
  3. Click Done to close Edit Context Variables screen and return to Process Designer.
  4. Save the process flow and exit from Process Designer.

    Image Removed
    Info

    You can also set this input variable using Process flow Variable or 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.
    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 required format. 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

  1. On the Adeptia Suite homepage, click the the Develop tab tab.
  2. Go to Services > Miscellaneous and then click Stored Procedure.

...

  1. The Manage Stored Procedure

...

  1.  screen is displayed (see Figure 617).

    Image Modified

...

  1. Figure 617: Manage Stored Procedure

  2. Click the Create New link. The Create Stored Procedure screen is displayed (see Figure 618).

    Image Modified

...

  1. Figure 618: Create Stored Procedure

  2. Enter the name and description for new stored procedure activity in the textbox Name and Description respectively.
  3. Select the database info activity from the dropdown list Database Info Id.

    Image Removed
    Info

    To learn how to create Database Info activity, refer to the section Creating Database Info in Administrator Guide.

  4. To select the database stored procedure, click the Browse button. The Select Stored Procedure screen with list of stored procedure is displayed (see Figure 619).

    Image Modified

...

  1. Figure 619: Select Stored Procedure

  2. Select the required stored procedure and click the Get Parameters button. The Stored Procedure Parameter screen is displayed with list of parameters (see Figure 620).

    Image Modified

...

...

  1. Figure 620: View Parameters

  2. Click OK to return to the Stored Procedure activity screen. Parameters of the selected procedure are populated in Stored Procedure Parameters field (see Figure 621).

    Image Modified

...

  1. Figure 621: Manage Stored Procedure

  2. In the Stored Procedure activity screen click the Save button.