15.00 - CHARACTERS - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1145-015K
Language
English (United States)

CHARACTERS

Purpose  

Returns an integer value representing the number of logical characters or bytes contained in the specified operand string.

Syntax  

where:

 

Syntax element …

Specifies …

string_expression

a character (single byte, multibyte, mixed single byte and multibyte) string for which the number of characters is to be returned.

The data types for string_expression are restricted to CHARACTER, VARCHAR, and CLOB.

ANSI Compliance

This is a Teradata extension to the ANSI SQL:2011 standard.

Value Returned by CHARACTERS and Server Character Set

Because CHARACTERS returns the number of logical characters or bytes in string_expression, the value differs depending on the server character set of string_expression. The following table illustrates the differences among the various character sets for a CHARACTER(12) column.

 

FOR this server character set …

The length of string_expression

  • UNICODE
  • LATIN
  • GRAPHIC
  • is always 12.

    Unicode, Latin, and Graphic are fixed width character types.

  • KANJISJIS
  • KANJI1
  • varies depending on the mix of characters (multibyte and single byte) in the string.

    KanjiSJIS and KANJI1 are variable width character sets.

    CHARACTER_LENGTH versus CHARACTERS

    Use of the CHARACTERS function is deprecated. Instead, use the ANSI‑equivalent “CHARACTER_LENGTH.”