Graphic string constants
A graphic string constant specifies a varying-length graphic string.
In EBCDIC environments, the forms of graphic string constants are shown in the following figure. (Shift-in and shift-out characters for EBCDIC data are discussed in Character strings.)1
In SQL statements and in host language statements in a source program, graphic string constants cannot be continued from one line to the next. A graphic string constant must be short enough so that its UTF-8 representation requires no more than 32704 bytes.
Db2 supports two types of hexadecimal graphic string constants.
- UX'xxxx' represents a string of graphic Unicode UTF-16 characters, where x is a hexadecimal digit. The number of digits must be a multiple of 4 and must not exceed 32704. Each group of 4 digits represents a single UTF-16 graphic character. For example, the UX constant for 'ABC' is UX'004100420043'.
- GX'xxxx' represents a string of graphic characters, where x is
a hexadecimal digit. The number of digits must be a multiple of 4.
Each group of 4 digits represents a single double-byte graphic character.
The hexadecimal shift-in and shift-out ('OE'X and 'OF'X),
which apply to EBCDIC only, are not included in the string.
If the MIXED DATA installation option is set to NO, a GX constant cannot be used. Instead, a UX constant should be used. A GX constant cannot be used when the encoding scheme is UNICODE.
For information about the CCSID that is assigned to a graphic string constant, including UX'xxxx' and GX'xxxx' string constants, see Encoding scheme and CCSID rules for strings.