NVARCHAR scalar function
The NVARCHAR function returns a varying-length national character string representation of a variety of data types.
Integer to nvarchar
Decimal to nvarchar
Floating-point to nvarchar
Decimal floating-point to nvarchar
Character to nvarchar
Graphic to nvarchar
Nchar to nvarchar
Datetime to nvarchar
The schema is SYSIBM.
The function name cannot be specified as a qualified name when keywords are used in the function signature.
NVARCHAR can be specified only in a Unicode database (SQLSTATE 560AA).
Result
The NVARCHAR function returns a varying-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 first 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
- An 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 NVARCHAR scalar function is a synonym for a scalar cast function
with result string units as specified in the following table.
NCHAR_MAPPING | Synonym function | Result string units |
---|---|---|
CHAR_CU32 | VARCHAR | CODEUNITS32 |
GRAPHIC_CU32 | VARGRAPHIC | CODEUNITS32 |
GRAPHIC_CU16 | VARGRAPHIC1 | CODEUNITS16 |
|