SQL Character Strings as Host Variables | Teradata Vantage - SQL Character Strings as Host Variables - Teradata Vantage - Analytics Database

SQL Stored Procedures and Embedded SQL

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
frc1628111662093.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
rjx1472253414573
lifecycle
latest
Product Category
Teradata Vantage™

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

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 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.