The APOST/QUOTE and APOSTSQL/QUOTESQL options control PL/I string recognition and generation, and the precompiler generates code appropriate for PL/I string usage.
The only values permitted for PL/I are APOST and APOSTSQL.
Native PL/I strings are enclosed by apostrophes (’).
The precompiler encloses all strings recognized by PL/I in apostrophes.
SQL strings are delimited by apostrophes (‘).
The escape character is quotation marks (“).
These options are described in Chapter 2: “Connecting to the Database and Invoking PP2.”
The APOSTSQL option controls multistatement request delimiting. As an example, with APOST/APOSTSQL, the application is the following:
DECLARE cursor CURSOR FOR
’SELECT * FROM table
WHERE COL1 = ’’ABCD’’;
UPDATE “table one” SET COL2 = ’’ABCD’’’;
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('$');
$ is the escape character.
User Defined Functions
User Defined Functions (UDFs) are valid in embedded SQL statements, but CREATE and REPLACE FUNCTION are not valid in PP2 applications. For further information, see SQL Data Definition Language (B035‑1144).