CHARACTER_LENGTH Function Examples | Teradata Vantage - Examples - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantage™

The following statement applies the CHARACTER_LENGTH function to the Name column, which is type VARCHAR(30) CHARACTER SET LATIN, to obtain the number of characters in each employee name:

   SELECT Name, CHARACTER_LENGTH(Name) 
   FROM Employee; 

The result is as follows (note that separator blanks are considered characters):

   Name      Character_Length(Name)
   --------  ----------------------
   Smith T            7
   Newman P           8
   Omura H            7
         .            .

Example Set 1: KanjiEBCDIC

FOR this server character set … AND example … CHARACTER_LENGTH returns …
GRAPHIC ABC 3
KANJI1 De<MNP > 10
<><> 4

Set 2: KanjiShift-JIS

FOR this server character set … AND example … CHARACTER_LENGTH returns …
KANJI1 <><> 10
D eF 3
UNICODE ABC 3
GRAPHIC ABC 3

Set 3: KanjiEUC

FOR this server character set … AND example … CHARACTER_LENGTH returns …
KANJI1 ss3 C ss3 D 2
GRAPHIC 2
UNICODE <><> 0
dA ss2 B ss3 E 4
LATIN ABC 3