Options

Pentaho Data Integration

Version
9.3.x
Audience
anonymous
Part Number
MK-95PDIA003-15
The Execute SQL Script step has the following options:
Option Description
SQL script to execute

Enter the SQL to execute. Separate statements with a semi-colon ( ; ) and use question marks as placeholders for parameters.

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.

The Bind parameters? and Quote Strings? options (explained below) are also allowed.

Execute for each row?
  • This option executes the SQL statement at the step's initialization phase. (Default)
  • 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).
Execute as a single statement

Select this option to send the entire SQL statement to the database.

Leave this option unselected to split the statement semi-colons ( ; ).

Variable substitution Select this option to include the use of variables in the SQL (for example: ${table_name} ).
Bind parameters?

Select this option to bind parameters using prepared statements.

Leave this option unselected if you want this step to perform a string replacement of the parameters.

Note: To use this option, the Execute for each row? option must also be selected.
Quote Strings?

Select this option to add quotation marks ( " ) around the string according to the database dialect and escape special characters like CR, LF, and " ".

Note: To use this option, the Execute for each row? option must also be selected.
Parameters

There are two ways to populate the parameters:

  • Click Get Fields (explained below) to automatically populate these parameters with the same parameters specified in the transformation step previous to Execute SQL Script.
  • Specify the parameters that will replace the question marks in the query.

    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.

    If you need the same parameter multiple times in your query, then 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.

To use this option, the Execute for each row? option must also be selected.

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.