Parameterized Queries - Teradata SQL Assistant

Teradata® SQL Assistant for Windows User Guide

Product
Teradata SQL Assistant
Release Number
16.20
Published
October 2018
Language
English (United States)
Last Update
2020-01-03
dita:mapPath
gfk1537201040714.ditamap
dita:ditavalPath
ft:empty
dita:id
B035-2430
Product Category
Teradata Tools and Utilities

Queries can contain Named Parameters, making it easy to reuse a query because the only changes are the data values (for example, in a Where clause).

Named Parameters function like variables. Enter the value for a named parameter once. If it is used in multiple places within the query, the same value is used in all places.

The values entered for named parameters are saved to the Notes column of History for future reference.

Named Parameters are indicated by a “?” immediately followed by a name. The name can consist of alphanumeric characters plus the “_” symbol.

When an parameterized query is executed, a prompt appears for each parameter before the query is submitted.

For example, if the following query is submitted:

Select * From PhoneBook Where LastName Like '?NameStart'

A prompt appears to enter a value for NameStart.

Parameter values are directly inserted into the query, which means they might need to be enclosed in quotes. Although quotes can be used when prompted for the data value, it is generally recommended to include quotes in the query itself, as in the above example. For more information, see Setting Query Options.