SQL/MX Programming Manual for Java

SQLJ Programming
HP NonStop SQL/MX Programming Manual for Java523726-003
3-46
Using Hexadecimal Values in Character String
Literals
Using Hexadecimal Values in Character String Literals
Another way of specifying a character string literal is to use the hexadecimal form of
the characters. This method is useful if your keyboard and operating system do not
support the desired character set.
Use hexadecimal values that correspond to the characters of a particular character set.
In this example, the 6771 and 4EAC hexadecimal values represent these characters of
the UCS2 character set:
This statement inserts these values into an SQL/MX table named DEPT_INTERNATL:
#sql {INSERT INTO dept_internatl
(deptnum, deptname, manager, rptdept, location)
VALUES (:deptNum, :deptName, :manager, :rptDept,
_UCS2 X'67714EAC')};
For information about the syntax of character string literals in hexadecimal form, see
the SQL/MX Reference Manual.
Specifying the Character Set Prefix
Specify the character set prefix before the character string literal. For example, the
_UCS2 prefix specifies that the character string literals are encoded with the UCS2
character set:
The character set prefix must match the character set of the corresponding SQL
column. If you omit the prefix, the character string literal is interpreted as ISO88591.
The omission of the character set prefix causes translation to fail if the string literal is
not encoded as ISO88591 and if the character set of the column is not ISO88591. For
information about the syntax of character string literals, see the SQL/MX Reference
Manual.
#sql {INSERT INTO dept_internatl
(deptnum, deptname, manager, rptdept, location)
VALUES (:deptNum, :deptName, :manager, :rptDept,
_UCS2' ')};
#sql {INSERT INTO dept_internatl
(deptnum, deptname, manager, rptdept, location)
VALUES (:deptNum, :deptName, :manager, :rptDept,
_UCS2 X'67714EAC')};