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.

The page guides you on how to create a stored procedure service in Adeptia Connect to retrieve a single value or a result set(s) generated by a stored procedure. You will also come to know when and how you can define the layout of a stored procedure in sections to follow.  

Creating a stored procedure service

A Stored Procedure service in Adeptia Connect helps you retrieve the output generated by a stored procedure of a database. The output can be a single value retrieved in a context variable or multiple values retrieved as a result set in the form of an XML stream. Ensure  

Ensure that you you meet the following prerequisites before you start creating a Stored Procedure service.

Prerequisites

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

Follow the steps below to create a Stored Procedure service:

  1. Click Configure > OTHERS > Stored Procedure.

  2. Click Create Stored Procedure.


  3. In the Name field, enter the name of the stored procedure service.
  4. In the Description field, enter the description of the stored procedure service.
  5. in the Database Info field, select the Database Info service.

    Info
    Click here to learn how to create Database Info activity.


  6. Int the Select Schema field, select the schema.

    Info
    The stored procedures associated with this schema are populated in the next field.


  7. In the Select Stored Procedure field, select the stored procedure from the list.

    Info
    Make sure that you have execute permissions on the database as only the procedures for which the database user has permission are available on the list.


  8. In the Stored Procedure Parameters section, in the Ouput Mode field, select either of the two modes, Context Parameters and XML Stream. The default output mode is Context Parameters.

    Info
    The output mode defines whether the stored procedure generates a stream or not. The stored procedure generates an XML output that contains the Result Sets, the Out, and the InOut parameters' values when XML Stream is selected as an the output mode. Selecting the Context Parameters as an the output mode sets the value of the Out and InOut variables in context.


  9. The subsequent steps to create the stored procedure service differ based on the output mode selected. 

    • In case of the Context Parameters as the output mode:

      1. The Parameters of the selected stored procedure are automatically populated in the respective Parameter's fields, In ParamsOut Params, and InOut Params, in Stored Procedure Parameters section.

        Tip
        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 case of the XML Stream as the output mode:

      1. The Define Layout section is visible wherein you can create the layout of the stored procedure by defining/adding the queries for the result set(s), the Out, and the InOut Parameters.

  10. In the Project field, select the project from the list.

  11. Click Save.