SQL Character Strings as Host Variables | Teradata Vantage - SQL Character Strings as Host Variables - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
xqq1557098602407.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantage™

Preprocessor2 treats SQL character strings as a third kind of host variable that is neither input nor output.

Definition

An SQL string is a series of characters used to complete an embedded SQL statement. It is not an input or an output variable because it does not correspond to a field in a row of a table.

Character Strings as Host Variables

SQL character strings are a distinct category of host variable because some host languages apply special rules to them. Those rules are detailed in the language-dependent sections of Teradata® Preprocessor2 for Embedded SQL Programmer Guide, B035-2446.

Character strings can require a leading COLON character when referenced in an embedded SQL statement. For details, see the individual statement syntax documentation in “Statement Syntax” in Teradata Vantage™ - SQL Data Manipulation Language, B035-1146 and in this section.

Statements That Use Strings as Host Variables

The following table lists embedded SQL statements that use SQL strings as host variables.

This SQL statement … Uses an SQL string as a host variable …
CHECKPOINT when the checkpoint label is expressed as a host variable.
DATABASE when the database name is expressed as a host variable.
EXECUTE IMMEDIATE when the SQL statement string is expressed as a host variable.
LOGON for the logon string.
PREPARE when the SQL statement string is expressed as a host variable.
SET CHARSET when the character set name is expressed as a host variable.