String Delimiters - Teradata Preprocessor2

Teradata® Preprocessor2 for Embedded SQL Programmer Guide

Product
Teradata Preprocessor2
Release Number
17.00
Published
June 2020
Language
English (United States)
Last Update
2020-06-19
dita:mapPath
whb1544831946911.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2446
lifecycle
previous
Product Category
Teradata Tools and Utilities

The APOST/QUOTE and APOSTSQL/QUOTESQL options control COBOL string recognition and generation.

The default values for COBOL are APOST and APOSTSQL; the precompiler generates code appropriate to the option specified.

For details, see Connecting to the Database and Invoking PP2.

Option Description
APOST Encloses native COBOL strings with apostrophes (’).

The precompiler encloses all strings recognized by COBOL in apostrophes.

QUOTE Delimits native COBOL strings with quotation marks (“).

If requesting this option, specify the COBOL compiler option QUOTE.

APOSTSQL and QUOTESQL affect SQL string delimiters and escape characters.

Option Description
APOSTSQL Delimits the strings embedded in a SQL statement with apostrophes.

The escape character is a quotation mark.

QUOTESQL Delimits the strings embedded in a SQL statement with quotes.

The escape character is an apostrophe.

The APOSTSQL/QUOTESQL option controls multi-statement request delimiting.

Delimited Identifiers and Character String Literals

Teradata SQL for Teradata Database 12.00 and later extends ANSI-compliant Unicode delimited identifiers and character string literals. This enables the Data Dictionary to function the same, whether or not Japanese character set support is enabled or not. Additionally, object names with multi-byte character sets can be shared between sessions that have non-Japanese character sets.

The Unicode delimited identifier is U&" ". The Unicode character string literal is U&' '. These new identifiers and literals are produced where ' 'XN and ' 'XC notation is used.

For example, prior to Teradata Database 12.00, the syntax to represent a Kanji string was:

SELECT * FROM '8273826082618250'XN;
/* This hexadecimal string represents the Kanji1 string using the KANJIEUC_0U character set*/

For Teradata Database 12.00 and later, the syntax is:

SELECT * FROM U&"\FF34\FF21\FF22\FF11";
/* for post V2R12.0.0 Unicode Data Dictionary, the internal hex is based on UNICODE hex for object name   */

In the above example, backslash (\) is the escape character. The default escape character depends on the session charset, but will be backslash (\) or yen sign for all supported character sets. The above SQL can also be written as:

SELECT * FROM U&"$FF34$FF21$FF22$FF11" UESCAPE('$');

where $ is the escape character.