15.10 - String Delimiters - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

Preprocessor2 for Embedded SQL
Programming Reference

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 Chapter 2: “Connecting to the Database and Invoking PP2.”





Encloses native COBOL strings with apostrophes (’).

The precompiler encloses all strings recognized by COBOL in apostrophes.


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.





Delimits the strings embedded in a SQL statement with apostrophes.

The escape character is a quotation mark.


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.