Skip to main content

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 NameDescription
1Step nameSpecify the name of the step; This name has to be unique in a single workflow
2ConnectionSelect a database connection to use
3SQL script to executeSpecify 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.

4Execute 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.
6Execute as a single statementThis option does not split the statements by; and will send the whole SQL to the database.
7Variable substitutionIn case you want to use variables in the SQL, e.g. ${table_name}, this option needs to be checked.
8Bind parameters?Check this option to bind parameters using prepared statements, otherwise this step will perform a literal string replacement of the parameters.
9Quote 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.
10ParametersThe 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.

11Field to contain insert stats (Optional)Specify a field name to hold the number or records that where inserted.
12Field to contain update statsSpecify a field name to hold the number or records that where updated.
13Same as insert stats, but for deleted rows.Specify a field name to hold the number or records that where deleted.
14Same as insert stats, but for read rows.Specify a field name to hold the number or records that where read.