docs.intersystems.com
Home  /  Application Development: Core Topics  /  InterSystems SQL Reference  /  SQL Functions  /  CHAR


InterSystems SQL Reference
CHAR
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


A string function that returns the character that has the ASCII code value specified in a string expression.
Synopsis
CHAR(code-value)
{fn CHAR(code-value)}
Arguments
code-value An integer code that corresponds to a character.
Description
CHAR returns the character that corresponds to the specified integer code value. Because InterSystems IRIS is a Unicode system, 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.
Examples
The following examples both return the character Z:
SELECT CHAR(90) AS CharCode
SELECT {fn CHAR(90)} AS CharCode
The following example returns the Greek letter lambda:
  &sql(SELECT {fn CHAR(955)}
       INTO :greeklet)
  WRITE !,"Greek letter: ",greeklet
See Also