The
NVARCHAR function returns a varying-length national character string
representation of a variety of data types.
Integer to nvarchar
>>-NVARCHAR--(--integer-expression--)--------------------------><
Decimal to nvarchar
>>-NVARCHAR--(--decimal-expression--+----------------------+--)-><
'-,--decimal-character-'
Floating-point to nvarchar
>>-NVARCHAR--(--floating-point-expression--+----------------------+--)-><
'-,--decimal-character-'
Decimal floating-point to nvarchar
>>-NVARCHAR--(--decimal-floating-point-expression--+----------------------+--)-><
'-,--decimal-character-'
Character to nvarchar
>>-NVARCHAR--(--character-expression--+------------+--)--------><
'-,--integer-'
Graphic to nvarchar
>>-NVARCHAR--(--graphic-expression--+------------+--)----------><
'-,--integer-'
Nchar to nvarchar
>>-NVARCHAR--(--national-character-expression--+------------+--)-><
'-,--integer-'
Datetime to nvarchar
>>-NVARCHAR--(--datetime-expression--+--------------+--)-------><
'-,--+-ISO---+-'
+-USA---+
+-EUR---+
+-JIS---+
'-LOCAL-'
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).
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
The NVARCHAR scalar function
is a synonym for a scalar cast function with result string units as
specified in the following table.
Table 1. NVARCHAR
scalar function synonymsNVARCHAR_MAPPING value |
Synonym function |
Result string units |
CHAR_CU32 |
VARCHAR |
CODEUNITS32 |
GRAPHIC_CU32 |
VARGRAPHIC |
CODEUNITS32 |
GRAPHIC_CU16 |
VARGRAPHIC1 |
CODEUNITS16 |
- When the first argument has string units CODEUNITS32 and the
second argument is not specified, the length attribute of the result
is different from the VARGRAPHIC function because the string units
of the result is CODEUNITS16. In this case, the length attribute of
the result is 2 times the length attribute of the result that is otherwise
determined by the VARGRAPHIC function.
|