Table of Contents

Search

  1. Preface
  2. RulePoint
  3. RulePoint Concepts
  4. Using RulePoint
  5. RulePoint Objects
  6. Working with Topics
  7. Working with Connections
  8. Working with Sources
  9. Working with Responders
  10. Working with Responses
  11. Working with Watchlists
  12. Working with Analytics
  13. DRQL
  14. Working with Rules
  15. Working with Alerts
  16. Setting Access Controls
  17. Troubleshooting RulePoint Issues
  18. Connecting to an Ultra Messaging Application
  19. Creating an Ultra Messaging JMS Source

User Guide

User Guide

SQL Response Example

SQL Response Example

After you define an SQL Responder service, you can create a response that processes an SQL command.
You can run the response with its default values using the following syntax:
WHEN 1 stock WITH symbol="XYZ" THEN SQLStockResponse
In this DRQL,
SQLStockResponse
is the name of the response.
If you want to override all default parameters in your response within the rule text, you can specify the parameters or name value pairs for changes in individual parameters. The following rule provides the syntax for overriding all of the parameters for the SQL responder service:
WHEN 1 stock WITH symbol="XYZ" THEN SQLStockResponse WITH params="name=${stock.symbol},value=${stock.price}"
If you want to override a specific parameter in your response within your rule text, you can specify that parameter as a response property. The following rule provides the syntax for overriding a specific parameter value for this service:
WHEN 1 stock WITH symbol="XYZ" THEN SQLStockResponse WITH value="${stock.price}"
In another example, create the following SQL statement using name value pair:
INSERT into Stock (name, value) values(<<name>>,<<value>>)
You can use the following parameters to populate the SQL statement:
name =${stock.symbol}, value=${stock.price}
All undefined parameters are set to the value of empty string (which is NULL in Oracle). SQL statements must handle the format of the parameter value provided at the substitution point in the statement.

Using Brackets [] to Substitute IN Clause Parameters for an SQL Statement

The brackets around a comma-separated list is a formatting feature that you can use to update the IN clause of the parameters of a responder or response. You can use the feature to update the parameters by a comma-separated list in brackets, [XYZ, INFA, ABC].
  1. Create an SQL responder.
    UPDATE stock set processed_ind='A' WHERE name in <<names>>
  2. Create and associate an SQL response with the responder.
    updateresult
  3. When the events
    event1: symbol=XYZ
    ,
    event2: symbol=INFA
    , and
    event3: symbol=ABC
    come into the Stock table, the following rule triggers:
    WHEN 3 stock s THEN updateresult WITH names="[ ${s.symbol(*,COMMA)}]"

Using a Raw List to Substitute IN Clause Parameters for an SQL Statement

The raw list is a formatting feature that allows you to update the SQL Responder or the SQL Response. You can use the feature to update the parameters by a list of stock symbols.
  1. Create an SQL responder.
    UPDATE stock set processed_ind='A' WHERE name in <<names>>
  2. Create and associate an SQL response with the responder.
    updateresult
  3. When the events
    event1: symbol=XYZ
    ,
    event2: symbol=INFA
    , and
    event3: symbol=ABC
    come into the Stock table, the following rule triggers:
    WHEN 3 stock s THEN updateresult WITH names=" ${s.symbol(raw )}"
Using the rule below, when the following events come into
stock1
: event1: symbol =IBM, event2: symbol=INFA, and event3: symbol=ABC, the rule fires.
For more information about other RulePoint formatting codes, such as NL and COLON, see
Formatting_the_Output_of_your_Response
.

0 COMMENTS

We’d like to hear from you!