A graphic string is a sequence of double-byte characters that do not include shift-out or shift-in characters.
The length of the string is the number of its characters. Like character strings, graphic strings can be empty.
Every graphic string has a CCSID that identifies a double-byte coded character set. If necessary, a graphic string is converted before it is used in an operation with a graphic string that has a different CCSID.
All values of a fixed-length graphic-string column have the same length, which is determined by the length attribute of the column. The length attribute must be between 1 through 16383 inclusive.
A graphic-string constant is a varying-length graphic string. The length of the specified string cannot be greater than 16370.
In the normal form, the SQL delimiters and the G or the N are SBCS characters. The SBCS apostrophe (') is the EBCDIC apostrophe, X'7D'.
In the PL/I form, the apostrophes and the G are DBCS characters. Two consecutive DBCS string delimiters are used to represent one string delimiter within the string. Notice that this PL/I form is only valid for static statements embedded in PL/I programs.
A hexadecimal graphic constant is also supported. The form of the hexadecimal graphic constant is:
GX'ssss'
In the constant, ssss represents a string from 0 to 32766 hexadecimal digits. The number of characters between the string delimiters must be an even multiple of 4. Each group of 4 digits represents a single graphic character. The hexadecimal for shift-in and shift-out (X'0E' and X'0F') are not included in the string.
The CCSID assigned to constants is the DBCS CCSID associated with the CCSID of the source unless the source is encoded in a foreign encoding scheme (such as ASCII). In this case, the CCSID assigned to the constant is the DBCS CCSID associated with the default CCSID of the application server when the SQL statement containing the constant is prepared. If there is no DBCS CCSID associated with the CCSID of the source, the CCSID is 65535.