Command Line Options | Encoding Options| Basic Teradata Query - 17.00 - Encoding Options - Basic Teradata Query

Basic Teradata® Query Reference

Basic Teradata Query
June 2020
Programming Reference
-c [Charset Encoding]
Defines the initial session character set encoding for BTEQ at startup time. This value can be a character set name or a character set code. By default, this option also defines the I/O encoding BTEQ uses if the -e and -m options are not used (see below).

The -c option overrides charset values defined in the clispb.dat file. To start a UTF-16 session, this option is required. The SESSION CHARSET command can subsequently be used (certain restrictions apply; see SESSION CHARSET) to change BTEQ's session character set. If the -c option and the clispb.dat file are not used to define a session character set, BTEQ sets SESSION CHARSET to ASCII.

-e [I/O Encoding]
Defines the I/O encoding BTEQ uses. This option is valid only when BTEQ is initially set to use a UTF8 or UTF16 session character set (either through the -c option or through the clispb.dat file). The value supplied must be the UTF8 or UTF16 name or code (63 or 62, respectively). Once the -e option has been used, the I/O encoding cannot be changed for that session. It is recommended that the -e option be used before the -c option.
Indicates that I/O encoding for an interactive Unicode session is encoded in multibyte characters based on the system locale, instead of true Unicode code points. This option does not use arguments and requires the use of the -c option, but not the -e option. Without this option, BTEQ always uses the default “C” locale.

Disclaimer:When a locale is in effect (activated by the -m option), BTEQ is limited to the type of characters that it can handle. For example, Thai characters cannot be read or displayed when a Russian locale is used. Characters outside the locale are most likely substituted with question marks ('?').

Example for defining the locale on Windows:

  1. Open the Control Panel.
  2. Select Regional and Language Options.
  3. Select a value for Language for non-Unicode programs.

    The appropriate language support might have to be installed first if the required language is not available.

  4. A reboot might be necessary.

Example for defining the locale on a UNIX operating system:

  1. Use locale -a to view the available locales.
  2. Set the LC_CTYPE environment variable to an available locale.
When an interactive Unicode session is used without the -m option, BTEQ is dependent upon the operating system's current language settings, which are assumed to support 7-bit ASCII characters. Therefore, for interactive input, BTEQ reads each character as a single-byte. This means that multibyte Unicode characters are not supported through input interactively. For output, BTEQ can write multibyte Unicode characters to stdout and stderr. However, the operating system might not recognize a multibyte Unicode character, and might display each byte separately instead. This is not an issue when BTEQ is run in batch mode.
Indicates that a Byte Order Mark (BOM) should be written to redirected stdout and stderr streams. This option is only valid for Workstation BTEQ sessions that generate Unicode output, where the I/O encoding is based upon the use of a -c option, -e option, or the encoding of the stdin script. It is BTEQ's intention to write a BOM only to output streams that are not being displayed to the terminal. If stdout and stderr are redirected to the same file or device, only one BOM will be written. If they are redirected separately, each stream will receive a BOM. But if stdout or stderr is being appended to a file, a BOM will not be written, since the file has already been established. Similarly, if no text is written to stdout or stderr, a solitary BOM will not be written. The -ob option can also be used when the output stream is redirected to a pipe.