Char Function; Considerations For Char; Example Of Char - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

CHAR Function

The CHAR function returns the character that has the specified code value, which must be of
exact numeric with scale 0.
CHAR is a Neoview SQL extension.
CHAR(code-value, [,char-set-name])
code-value
is a valid code value in the character set in use.
char-set-name
can be ISO88591, UCS2, SJIS (for the SJIS configuration only), or UTF8 (for the Unicode
configuration only). The returned character will be associated with the character set specified
by char-set-name with the DEFAULT collation.
On a Neoview platform that has the ISO88591 configuration, the default is ISO88591. For the
SJIS configuration, the default is ISO88591 containing SJIS characters. For the Unicode
configuration, the default is UCS2. For more information on the Neoview character set
configurations, see the Neoview Character Sets Administrator's Guide.
TIP:
If you are using the SJIS configuration and want to ensure future compatibility, you
should explicitly specify SJIS as the character set name rather than letting it default to
ISO88591.

Considerations for CHAR

For the ISO88591 character set, the return type is VARCHAR(1) for the ISO88591
configuration, VARCHAR(2) for the SJIS configuration, and VARCHAR(4) for the Unicode
configuration.
For the UCS2 character set, the return type is CHAR(1).
For the SJIS character set, the return type is VARCHAR(2).
For the UTF8 character set, the return type is VARCHAR(4).
For more information on using multibyte character sets, see the Neoview Character Sets
Administrator's Guide.

Example of CHAR

Select the column CUSTNAME and return the ASCII code of the first character of the customer
name and its CHAR value:
SELECT custname, ASCII (custname), CHAR (ASCII (custname))
FROM sales.customer;
CUSTNAME
------------------
CENTRAL UNIVERSITY
BROWN MEDICAL CO
STEVENS SUPPLY
PREMIER INSURANCE
...
--- 15 row(s) selected.
360
SQL Functions and Expressions
(EXPR)
(EXPR)
-------
-------
67
C
66
B
83
S
80
P
...
...

Advertisement

Table of Contents
loading

Table of Contents