|Oracle9i SQL Reference
Release 2 (9.2)
Part Number A96540-02
CHR returns the character having the binary equivalent to
n in either the database character set or the national character set.
NCHAR_CS is not specified, then this function returns the character having the binary equivalent to
n as a
VARCHAR2 value in the database character set.
NCHAR_CS is specified, then this function returns the character having the binary equivalent to
n as a
NVARCHAR2 value in the national character set.
For single-byte character sets, if
n > 256, then Oracle returns the binary equivalent of
n mod 256. For multibyte character sets,
n must resolve to one entire codepoint. Invalid codepoints are not validated, and the result of specifying invalid codepoints is indeterminate.
Use of the
The following example is run on an ASCII-based machine with the database character set defined as WE8ISO8859P1:
To produce the same results on an EBCDIC-based machine with the WE8EBCDIC1047 character set, the preceding example would have to be modified as follows:
For multibyte character sets, this sort of concatenation gives different results. For example, given a multibyte character whose hexadecimal value is
a1 representing the first byte and
a2 the second byte), you must specify for
n the decimal equivalent of '
a1a2', or 41378. That is, you must specify:
You cannot specify the decimal equivalent of a1 concatenated with the decimal equivalent of a2, as in the following example:
However, you can concatenate whole multibyte codepoints, as in the following example, which concatenates the multibyte characters whose hexadecimal values are
The following example uses the UTF8 character set: