CHR
CHR returns the ASCII character corresponding to the numeric value you pass to this function. ASCII values fall in the range 0 to 255. You can pass any integer to CHR, but only ASCII codes 32 to 126 are printable characters.
Syntax
CHR( numeric_value )
Argument | Required/ Optional | Description |
---|
numeric_value | Required | Numeric datatype. The value you want to return as an ASCII character. You can enter any valid expression. |
Return Value
ASCII character. A string containing one character.
NULL if a value passed to the function is NULL.
Example
The following expression returns the ASCII character for each numeric value in the ITEM_ID column:
CHR( ITEM_ID )
ITEM_ID | RETURN VALUE |
---|
65 | A |
122 | z |
NULL | NULL |
88 | X |
100 | d |
71 | G |
Use the CHR function to concatenate a single quotation mark onto a string. The single quotation mark is the only character that you cannot use inside a string literal. Consider the following example:
'Joan' || CHR(39) || 's car'
The return value is:
Joan's car