Purpose
Controls the mapping of data, object names and identifier values.
Usage Notes
CHARSET specifies the predefined character set name or character set code to be used at the following times:
Time | Action Taken |
---|---|
Precompile | The CHARSET option tells the precompiler the character set in which the input/output source files, the output listing, and output messages are written. |
Runtime | The precompiler establishes the character set for communicating with the database as the value of the CHARSET option unless overridden by the character set designated by the SET CHARSET request. For information on SET CHARSET, see Teradata Vantage™ - SQL Stored Procedures and Embedded SQL, B035-1148. Subsequent connections to the database use the most recently established character set. |
Specify the CHARSET option before the DATABASE or USERID operations if the DATABASE or USERID option values contain any Kanji or other multibyte character set characters.
CHARSET controls the mapping of data, object names and identifier values.
On IBM mainframe client platforms, if the CHARSET option is not specified, PP2 establishes the default character set by order of precedence:
- Character set specified in the HSHSPB parameter module.
- Default character set defined on the server specified by the TDPID option when SQLCHECK(FULL) is specified.
- EBCDIC
On network platforms, if the CHARSET option is not specified, PP2 establishes the default character set by order of precedence:
- The character set specified in the clispb.dat file
- ASCII
UTF-8 and UTF-16 Support
UTF-8 (Universal Transformation Format) and UTF-16 character sets are supported.
For details, see the tables in Supported Character Sets.
Use the SET CHARSET control statement with these character sets. For more information, see Teradata Vantage™ - SQL Stored Procedures and Embedded SQL, B035-1148.
- CHARSET(EBCDIC) on mainframe systems
- -cs ASCII on workstation-attached systems
Programming Considerations When Programming with UTF-8 and UTF-16 Character Sets
Object Names in Embedded SQL- Use only digits (0-9) and simple, single-byte Latin letters (A to Z, a to z).
These characters always translate to the same internal representation, therefore they appear exactly the same in any session, regardless of the client system or the character set.
- Do not use the hexadecimal representation to represent a character name.
- Use host variables in the embedded SQL to supply UTF-8 and UTF-16 input values to, or receive UTF-8 and UTF-16 output values from, the database. Use host variables in the embedded SQL statements instead of UTF-8 and UTF-16 string constants.
- Use only digits and simple, single byte Latin letters (A to Z, a to z) as constants in EXEC SQL statements. The constants must be in the same charset encoding as the SQL keywords.