Stored Procedure

This diagram element uses a stored procedure to interact with the database.

Diagram Element

Parameter Description

  • Node Name: name of a node.
  • Description: details of a node.
  • Stored Procedure: stored procedure added on the Configuration Center > Flow Configuration > Resource > Stored Procedure page.
  • Cache Variable and Response Attribute: flow variables and their values. The output parameter returned by the stored procedure is valid only on the current node. If you want to use the value in subsequent flow nodes, define a cache variable here and assign the value of the output parameter to the cache variable.
  • Condition and Condition Expression: branches of the exit of the current diagram element. For example, you can set a branch based on the value of an output parameter in the stored procedure. Different subsequent flows can be specified for each branch.

Using the Diagram Element

The Stored Procedure diagram element is used when data needs to be imported to the database. It cannot be used in public cloud scenarios. In scenarios where the OIAP is independently deployed, the database you access needs to be deployed in the same security zone as the OIAP for security purposes.

Currently, the stored procedure applications of the MySQL database, Oracle database, and GaussDB are supported.

Click the diagram element or drag it to the canvas, select the stored procedure to be invoked, set its input parameters, and add cache variables to temporarily save its output parameters. For the list type in output parameters, you need to set it separately based on rules.

Typical Application Scenario

The following describes how to use the Stored Procedure diagram element.

  1. Sign in to the AICC and choose Configuration Center > Chatbot Management > Flow Configuration.
  2. Configure a database.

    1. Contact the system administrator to add the database URL to the trustlist.
    2. Choose Resource > Stored Procedure, click the Stored Procedure Databases tab, and click Create.
      Figure 1 Configuring a stored procedure database

  3. Configure a stored procedure.

    1. Obtain the developed stored procedure script. An example is as follows:
      Figure 2 Stored procedure script example
    2. Choose Resource > Stored Procedure, click the Stored Procedures tab, and click Create.
      Figure 3 Basic Information page
      Figure 4 Input Parameter page
      Figure 5 Output Parameter page

  4. Configure an intelligent IVR flow. The usage of the Stored Procedure diagram element is similar to that of the Interface Invoking diagram element. Select the configured stored procedure, set input parameters, and assign output parameters to a variable as required.

    1. Choose Resource > Variable, click the Custom Variable tab, and click Create to add a system variable for receiving the output parameters of the stored procedure.
      Figure 6 System variable to be added
    2. Choose Flow > Orchestration and click New to add a simple flow.
      Figure 7 Flow orchestration example (Stored Procedure diagram element)

      Use the reply variable GLOBAL.xxxx for the Robot Reply diagram element to reply the number output by the stored procedure to the customer.

    3. Save and publish the flow.
    4. Choose Intelligent Chatbot and bind the flow to a robot.

  5. Choose Configuration Center > Access Configuration > Called Party and add a called route. Set the IVR to the added intelligent IVR.
  6. Log in to the OpenEye using a softphone number to simulate a customer, and dial the access code added on the Called Party page. If the robot can query the number output by the stored procedure based on the calling number and reply it to the customer, the configuration is successful.