Behavior
- Connects to a pre-configured database using the connection ID
- Executes parameterized queries to prevent SQL injection
- Stores results in the configured variable name
- Routes to
Success,Error, orNo Resultsbased on the outcome
Configuration
Connection & operation
| Parameter | Type | Default | Options | Description |
|---|---|---|---|---|
connectionId | string | "" | — | Database connection ID (configured in workspace settings) |
operation | enum | "query" | query, insert, update, delete, call_procedure | Database operation type |
query | string | "" | — | SQL query or stored procedure name |
timeout | number | 10000 | 1,000–60,000 | Query timeout in milliseconds |
Parameters
Each entry in theparameters array:
| Field | Type | Description |
|---|---|---|
name | string | Parameter name (maps to a placeholder in the query) |
value | string | Parameter value. Supports {{variable}} interpolation. |
type | enum | Data type: string, number, boolean, date |
Results
| Parameter | Type | Default | Description |
|---|---|---|---|
resultVariable | string | "db_result" | Variable name to store query results |
singleRow | boolean | false | Return only the first row instead of all rows |
Output handles
| Handle | Description |
|---|---|
| Success | Query executed successfully with results |
| Error | Query failed (connection error, syntax error, timeout) |
| No Results | Query executed but returned no rows |
Output variables
| Variable | Type | Description |
|---|---|---|
rows | array | Array of result rows |
row_count | number | Number of rows returned or affected |
Example
Look up a customer by account number:| Name | Value | Type |
|---|---|---|
account_id | {{digits}} | string |
Use cases
Account verification
Account verification
After Collect Digits, query the database for the account. On
DB.NO_RESULTS, play “Account not found” and retry. On success, greet the customer by name.Call logging
Call logging
Use the
insert operation to log call details (caller ID, timestamp, department) into a calls table at the end of the flow.Stored procedure
Stored procedure
Set
operation to call_procedure to execute complex business logic like credit checks or eligibility verification.