Skip to main content

CHAR (SQL)

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)}

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.

Arguments

code-value

An integer code that corresponds to a character.

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:

SELECT {fn CHAR(955)} AS GreekLetter

See Also

FeedbackOpens in a new tab