Execute SQL Script
Description
Execute SQL script is a step in the Scripting Plugin for Process Studio Workflows. You can execute SQL scripts with this step, either once, during the initialization phase of the workflow, or once for every input-row to the step. However, because of the scripting/dynamic nature of the step, it does not use prepared statements and thus is not intended to work fast or optimal. For good performance turn to dedicated steps like Table Output (insert into), Table Input (Select), Update, Delete, etc.
Configurations
No. | Field Name | Description |
---|---|---|
1 | Step name | Specify the name of the step; This name has to be unique in a single workflow |
2 | Connection | Select a database connection to use |
3 | SQL script to execute | Specify the SQL to execute. Separate statements by; and use question marks as place holders for parameter. Note: This step does not use prepared statements by default; therefore the given parameters have to be enclosed correctly. Numeric values do not need to be enclosed, but all others e.g. Strings need to be enclosed with quotes or double quotes depending on the database dialect. |
4 | Execute for each row? | Enable checkbox to execute the SQL for each incoming row. In this case parameters can be used. When this option is unchecked, the SQL statement is executed at the step initialization phase. |
6 | Execute as a single statement | This option does not split the statements by; and will send the whole SQL to the database. |
7 | Variable substitution | In case you want to use variables in the SQL, e.g. ${table_name} , this option needs to be checked. |
8 | Bind parameters? | Check this option to bind parameters using prepared statements, otherwise this step will perform a literal string replacement of the parameters. |
9 | Quote Strings? | This option adds quotes around the string according to the database dialect and also escapes special characters like CR, LF and the quote character itself. |
10 | Parameters | The list of used parameters that will replace the question marks in the query in the given order. So the first question mark will be replaced by the first parameter, the second question mark by the second parameter etc. Note: If you need the same parameter multiple times in your query, you need to use multiple question marks. Using a "Select Values" step you can duplicate field values within the "Select & Alter" tab by selecting the value once and renaming it a second or third time. |
11 | Field to contain insert stats (Optional) | Specify a field name to hold the number or records that where inserted. |
12 | Field to contain update stats | Specify a field name to hold the number or records that where updated. |
13 | Same as insert stats, but for deleted rows. | Specify a field name to hold the number or records that where deleted. |
14 | Same as insert stats, but for read rows. | Specify a field name to hold the number or records that where read. |