NCHAR scalar function
The NCHAR function returns a fixed-length national character string representation of a variety of data types.
Integer to nchar
Decimal to nchar
Floating-point to nchar
Decimal floating-point to nchar
Character to nchar
Graphic to nchar
Nchar to nchar
Datetime to nchar
The schema is SYSIBM. The function name cannot be specified as a qualified name when keywords are used in the function signature.
The NCHAR function can be specified only in a Unicode database (SQLSTATE 560AA).
Result
The NCHAR function returns a fixed-length national character string representation of:
- An integer number, if the first argument is a SMALLINT, INTEGER, or BIGINT
- A decimal number, if the first argument is a decimal number
- A double-precision floating-point number, if the first argument is a DOUBLE or REAL
- A decimal floating-point number, if the argument is a decimal floating-point number (DECFLOAT)
- A character string, if the first argument is any type of character string
- A graphic string, if the first argument is any type of graphic string
- A national character string, if the first argument is any type of national character string
- A datetime value, if the first argument is a DATE, TIME, or TIMESTAMP
- A Boolean value (TRUE or FALSE)
The NCHAR scalar function is a synonym for a scalar cast function with
result string units as specified in the following table.
NCHAR_MAPPING value | Synonym function | Result string units |
---|---|---|
CHAR_CU32 | CHAR | CODEUNITS32 |
GRAPHIC_CU32 | GRAPHIC | CODEUNITS32 |
GRAPHIC_CU16 | GRAPHIC1 | CODEUNITS16 |
|