Database Query

Constructs and optionally runs an SQL query on a database table.

To use this action cell, you should be familiar with basic database terminology and SQL queries. To operate on information stored in a storm DATA MANAGEMENT table, use the Data Management action cell instead.

Properties

Create New Query Statement/Use Existing Query Statement

Either create a new query statement or use an existing one. This is used to reference the query in an Execute Query action cell, and also in a Fetch Query Result action cell if you are using a SELECT query to retrieve information from a table into your script.

Data Source

Use this to select the data source identifier for the database containing the table against which the query will be run.

Query String

Enter an SQL query string, either by typing in the query here or using a string variable in which the query has been predefined. Standard SQL syntax is used. For example,

SELECT name, result, comments FROM customer WHERE postcode = ‘SL6’

where,

name, result, comments and postcode are the names of columns in the table customer.

The values in the columns name, result and comments are to be returned to the FLOW script.

You may use the ? character as a placeholder for the names of the columns, the name of the table, and any values to be used as criteria, and then supply the value using a variable. For example,

SELECT ?, ?, ? FROM customer WHERE postcode = ‘?’

This requires you to specify variables in the Query Parameter list in the order in which they will be used to replace the ? placeholders in the query statement (see below).

Execute Query

Select this to execute the query. Alternatively, leave this clear and execute the query later in the script using the Execute Query action cell.

If the query is run, the results and the number of rows found are stored in memory and also to variables configured in the 'Query Result' list of this action cell (see below).

The results held in memory can be accessed by the Fetch Query Result action cell.

Number of Result Rows

Optionally, enter an integer variable to hold the number of result rows returned by the query if it is executed.

Bind Parameter Variable

Build a list of parameters for providing information to the query. If your query contains ? placeholders, these must in the same order as those in the query statement.

Enter a values in the field above the list (as a literal value preceded by=, or a variable of the correct type), and then click Add.

Bind Result Variable

Build a list of result variables for storing information returned by the query if it is executed by the action cell.

Enter a variable of the correct type in the field above the list and then click Add.

Exit points

Exit point

Taken

[Complete]

If the query has been created successfully (and executed, where relevant).

Access Denied

If the query has not been created successfully (or executed, where relevant).