The SELECT action executes an SQL SELECT statement against a supported database.
Use this action to retrieve information from a database. Query parameters can be passed separately from the SQL statement using metadata values, allowing process variables, form data, and integration values to be used when filtering query results. Database queries are executed using prepared statements to support secure parameter handling.
The input parameters of the action are:
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | String | Required | The SQL SELECT statement to execute against the database. |
| metadata | JSON | Optional | A list of parameters that can be passed into the SQL statement. |
The metadata parameter can be used to pass process variables into the SQL statement. The example metadata:
{
"customerStatus": "Active",
"region": "EMEA"
}
`
Can be used for the following query:
SELECT customer_id,
customer_name,
email_address
FROM customers
WHERE status = {customerStatus}
AND region = {region}
ORDER BY customer_name;
This can be used in the query parameter as:
In this example, the values contained in metadata are substituted into the query as prepared statement parameters when the SQL statement is executed.
The output parameters from a select query are:
| Parameter | Type | Required | Description |
|---|---|---|---|
| result | Integer | Optional | A JSON object containing the data returned by the SELECT statement. The following is an
example of a query that returned two customer records from a
database:{
"result": [
{
"customer_id": "CUST-10025",
"customer_name": "Contoso Ltd",
"email_address": "contact@contoso.com"
},
{
"customer_id": "CUST-10031",
"customer_name": "Fabrikam Inc",
"email_address": "info@fabrikam.com"
}
]
}
|