Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section


A string function that returns the character that has the ASCII code value specified in a string expression.


{fn CHAR(code-value)}


Argument Description
code-value An integer code that corresponds to a character.


CHAR returns the character that corresponds to the specified integer code value. On Unicode systems, you can specify the integer code for any Unicode character, 0 through 65535. CHAR returns NULL if code-value is a integer that exceeds the permissible range of values.

CHAR returns an empty string ('') if code-value is a nonnumeric string. CHAR returns NULL if passed a NULL value.

Note that CHAR can be used as an ODBC scalar function (with the curly brace syntax) or as an SQL general function.


The following examples both return the character Z:

Copy code to clipboard
SELECT {fn CHAR(90)} AS CharCode
Copy code to clipboard

The following example returns the Greek letter lambda:

  IF $SYSTEM.Version.IsUnicode() {
  &sql(SELECT {fn CHAR(955)}
       INTO :greeklet)
  WRITE !,"Greek letter: ",greeklet
  ELSE {WRITE "This example requires a Unicode installation of Caché"}
Copy code to clipboard

Note that the above example requires a Unicode installation of Caché.

See Also