SQL Reference
Character to Vargraphic:
>>-VARGRAPHIC--(--character-string-expression--)---------------><
Graphic to Vargraphic:
>>-VARGRAPHIC--(--graphic-string-expression----+-------------+-->
'-,--integer--'
>----)---------------------------------------------------------><
The schema is SYSIBM.
The VARGRAPHIC function returns a graphic string representation of a:
- character string value, converting single byte characters to double byte
characters
- graphic string value, if the first argument is any type of graphic
string.
The result of the function is a varying length graphic string (VARGRAPHIC
data type). If the first argument can be null, the result can be
null; if the first argument is null, the result is the null value.
Character to Vargraphic
- character-string-expression
- An expression whose value must be of a character string data type other
than LONG VARCHAR or CLOB, and whose maximum length must not be greater than
16 336 bytes.
The length attribute of the result is equal to the length attribute of the
argument.
Let S denote the value of the
character-string-expression. Each single-byte character in S
is converted to its equivalent double-byte representation or to the
double-byte substitution character in the result; each double-byte
character in S is mapped 'as-is'. If the first byte of a
double-byte character appears as the last byte of S, it is converted into the
double-byte substitution character. The sequential order of the
characters in S is preserved.
The following are additional considerations for the conversion.
- For a Unicode database, this function converts the character-string from
the code page of the operand into UCS-2. Every character of the
operand, including DBCS characters, is converted. If the second
argument is given, it specifies the desired length (number of UCS-2
characters) of the resulting UCS-2 string.
- The conversion to double-byte code points by the VARGRAPHIC function is
based on the code page of the operand.
- Double-byte characters of the operand are not converted (see Appendix O, Japanese and Traditional-Chinese EUC Considerations for exception). All other characters are converted to
their corresponding double-byte depiction. If there is no corresponding
double-byte depiction, the double-byte substitution character for the code
page is used.
- No warning or error code is generated if one or more double-byte
substitution characters are returned in the result.
Graphic to Vargraphic
- graphic-string-expression
- An expression that returns a value that is a graphic string.
- integer
- The length attribute for the resulting varying length graphic
string. The value must be between 0 and 16 336. If
this argument is not specified, the length of the result is the same as the
length of the argument.
If the length of the graphic-string-expression is greater than the
length attribute of the result, truncation is performed and a warning is
returned (SQLSTATE 01004) unless the truncated characters were all blanks and
the graphic-string-expression was not a long string (LONG VARGRAPHIC
or DBCLOB).
[ Top of Page | Previous Page | Next Page ]