Char_Length Function; Considerations For Char_Length; Char And Varchar Operands; Examples Of Char_Length - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

CHAR_LENGTH Function

The CHAR_LENGTH function returns the number of characters in a string. You can also use
CHARACTER_LENGTH.
CHAR[ACTER]_LENGTH (string-value-expression)
string-value-expression
specifies the string value expression for which to return the length in characters. Neoview
SQL returns the result as a two-byte signed integer with a scale of zero. If
string-value-expression is null, Neoview SQL returns a length of null. See
Value Expressions" (page

Considerations for CHAR_LENGTH

CHAR and VARCHAR Operands

For a column declared as fixed CHAR, Neoview SQL returns the maximum length of that column.
For a VARCHAR column, Neoview SQL returns the actual length of the string stored in that
column.

Examples of CHAR_LENGTH

This function returns 12 as the result. The concatenation operator is denoted by two vertical
bars (||).
CHAR_LENGTH ('ROBERT' || ' ' || 'SMITH')
The string '' is the null (or empty) string. This function returns 0 (zero):
CHAR_LENGTH ('')
The DEPTNAME column has data type CHAR(12). Therefore, this function always returns
12:
CHAR_LENGTH (deptname)
The PROJDESC column in the PROJECT table has data type VARCHAR(18). This function
returns the actual length of the column value—not 18 for shorter strings—because it is a
VARCHAR value:
SELECT CHAR_LENGTH (projdesc)
FROM persnl.project;
(EXPR)
----------
--- 6 row(s) selected.
302
SQL Functions and Expressions
208).
14
13
13
17
9
9
"Character

Advertisement

Table of Contents
loading

Table of Contents