CHR Function

This function accepts an unsigned integer argument, and returns a single logical character.

The CHR function has this syntax:

CHR Function

CHR(expression)
Element Description Restrictions Syntax
expression Expression that evaluates to a nonnegative whole number less than 256 Must be an integer in the range 0 through 255 (inclusive) Expression

The data type of the return value is VARCHAR(1).

The argument can be SMALLINT, INTEGER, SERIAL, INT8, SERIAL8, BIGINT, or BIGSERIAL. The argument must evaluate to a whole number in the range 0 through 255.

If the argument is an integer in the range 0 through 127, the return value is the corresponding single-byte ASCII code point. For a listing of the characters corresponding to the ASCII code points 0 through 127, see Collating Order for U.S. English Data.

If the argument is an integer in the range 128 through 255, the return value is the corresponding 2-byte code point in the default code set.
  • On UNIX platforms, the default code set is ISO8859-1.
  • On Windows platforms, the default code set is Microsoft 1252.