15.12 - Parameterized Queries - Teradata Studio

Teradata Studio Express User Guide

Teradata Studio
August 2016
User Guide

SQL statements can contain parameter placeholders (question marks) in most cases where you can specify constants. When you run SQL that contains one or more parameter placeholders from the SQL Editor, you are prompted to specify the values for each of the parameters. The values you specify are substituted for the parameter placeholders when the SQL executes.

Named Parameters

A special SQL element in the SQL Editor enables you to assign names to parameter placeholders. The form of the new element is: ?\name

This form follows the rules of forming unquoted names which is a question mark followed by a back slash followed by a name with no space between the parts.

Parameters that are specified without a name, that is, by using just the question mark alone, display with the name "Parameter n" where the n indicates the index of the parameter for the SQL value.

For character string or binary columns, the Configure Parameters dialog provides a From File option which reads the input value from a file. To specify the input file, select the cell ellipsis (...) and display a dialog in which you can specify the input file.

Re-executing Parameterized Queries

When you select an entry in the list of operations in the SQL Results view that is produced by running parameterized SQL and select Reexecute from the context menu, you are presented with a dialog for specifying the parameter values. The dialog initially contains the values that were used to produce the results.