# Options

The Execute SQL Script step has the following options:

| Option                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **SQL script to execute**         | <p>Enter the SQL to execute. Separate statements with a semi-colon ( ; ) and use question marks as placeholders for parameters.</p><p>The given parameters must be enclosed correctly. Numeric values do not need to be enclosed, but all others (for example, strings) must be enclosed with single quotation marks ( ' ) or double quotation marks ( " ) depending on the database dialect.</p><p>The <strong>Bind parameters?</strong> and \*\*Quote Strings?\*\*options (explained below) are also allowed.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **Execute for each row?**         | <ul><li>This option executes the SQL statement at the step's initialization phase. (Default)</li><li>Select this option to execute the SQL for each incoming row and to specify the optional parameters for records inserted, updated, deleted, or read (explained below).</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **Execute as a single statement** | <p>Select this option to send the entire SQL statement to the database.</p><p>Leave this option unselected to split the statement semi-colons ( ; ).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| **Variable substitution**         | Select this option to include the use of variables in the SQL (for example: *${table\_name}* ).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **Bind parameters?**              | <p>Select this option to bind parameters using prepared statements.</p><p>Leave this option unselected if you want this step to perform a string replacement of the parameters.</p><p><strong>Note:</strong> To use this option, the \*\*Execute for each row?\*\*option must also be selected.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **Quote Strings?**                | <p>Select this option to add quotation marks ( " ) around the string according to the database dialect and escape special characters like <code>CR</code>, <code>LF</code>, and <code>" "</code>.</p><p><strong>Note:</strong> To use this option, the \*\*Execute for each row?\*\*option must also be selected.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| **Parameters**                    | <p>There are two ways to populate the parameters:</p><ul><li>Click <strong>Get Fields</strong> (explained below) to automatically populate these parameters with the same parameters specified in the transformation step previous to <strong>Execute SQL Script</strong>.</li><li>Specify the parameters that will replace the question marks in the query.</li></ul><p>The parameters must be presented in the same order as specified in the query. The first question mark will be replaced by the first parameter, the second question mark by the second parameter, and so on.</p><p>If you need the same parameter multiple times in your query, then use multiple question marks.</p><p>Using a <a href="/pages/5EgheGCvbFvXbTSJC1O2">Select Values</a> step, you can duplicate field values within the <strong>Select & Alter</strong> tab by selecting the value once and renaming it a second or third time.</p><p>To use this option, the \*\*Execute for each row?\*\*option must also be selected.</p> |
| **Get Fields** (button)           | Click to automatically populate the parameters in the Execute SQL Script with the same parameters that are specified in the transformation step previous to Execute SQL Script.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pentaho.com/pdia-data-integration/10.2-data-integration/pdi-transformation-steps-reference-overview/execute-sql-script-cp/options-execute-sql-script.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
