DB2 - Problembeschreibung
Problem IC62955 | Status: Geschlossen |
SQL16061 RETURNED WHEN CASTING HEXBINARY, BASE64BINARY TO VARCHAR FOR BIT DATA DATA TYPE | |
Produkt: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problembeschreibung: | |
A sql16061 error may be incorrectly raised when casting XML value of xs:hexBinary, xs:base64Binary encoding to VARCHAR FOR BIT DATA data type. The error indicates that the length specified for the varchar for bit data type is not large enough for the encoded xml value. For example, in the following query, if the element <executable_id> is encoded in a 32-byte array using xs:hexBinary(which means it is encoded using 64 characters), extracting this element as type varchar(32) for bit data will raise an error when it should not. This is because we are checking the length of the character string value of 64 bytes instead of checking the length of the encoded binary (hexBinary value) which is 32 bytes. SELECT EXECUTABLE_ID FROM XMLTABLE ( '$doc/details' PASSING XMLPARSE( DOCUMENT DETAILS) as "doc" COLUMNS "EXECUTABLE_ID" VARCHAR(32) FOR BIT DATA PATH 'executable_id cast as xs:hexBinary' ) AS DETAILS; Sample Doc: <details> ... <executable_id>0100000000000000010000000000000000000000020020090 421100437514686</executable_id> ... </details> | |
Problem-Zusammenfassung: | |
**************************************************************** * USERS AFFECTED: * * DB2 LUW All Platforms * **************************************************************** * PROBLEM DESCRIPTION: * * A sql16061 error may be incorrectly raised when casting XML * * * * value of xs:hexBinary, xs:base64Binary encoding to VARCHAR * * FOR * * BIT DATA data type. * * * * * * * * The error indicates that the length specified for the * * varchar * * for bit data type is not large enough for the encoded xml * * value. * * * * * * For example, in the following query, if the element * * * * <executable_id> is encoded in a 32-byte array using * * * * xs:hexBinary(which means it is encoded using 64 characters), * * * * extracting this element as type varchar(32) for bit data * * will * * raise an error when it should not. This is because we are * * * * checking the length of the character string value of 64 * * bytes * * instead of checking the length of the encoded binary * * * * (hexBinary value) which is 32 bytes. * * * * * * * * SELECT EXECUTABLE_ID * * * * FROM * * * * XMLTABLE ( * * * * '$doc/details' PASSING XMLPARSE( DOCUMENT * * * * DETAILS) as "doc" COLUMNS "EXECUTABLE_ID" VARCHAR(32) * * FOR * * BIT DATA PATH 'executable_id cast as xs:hexBinary' * * * * ) AS DETAILS; * * * * * * * * Sample Doc: * * * * * * * * <details> * * * * ... * * * * <executable_id>01000000000000000100000000000000000000000200200 * 421100437514686</executable_id> * * * * ... * * * * </details> * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 v97 Fixpack 1 * **************************************************************** | |
Local-Fix: | |
For the VARCHAR FOR BIT length, use a length value which is equal or larger to the character string size before its encoded to hexBinary or base64Binary. In the example listed the work around would be using VARCHAR(64) FOR BIT DATA | |
verfügbare FixPacks: | |
DB2 Version 9.7 Fix Pack 1 for Linux, UNIX, and Windows | |
Lösung | |
The problem occurs because we are checking the length of the character string value of 64 bytes instead of checking the length of the encoded binary (hexBinary value) which is 32 bytes. | |
Workaround | |
keiner bekannt / siehe Local-Fix | |
Weitere Daten | |
Datum - Problem gemeldet : Datum - Problem geschlossen : Datum - der letzten Änderung: | 02.09.2009 23.02.2010 23.02.2010 |
Problem behoben ab folgender Versionen (IBM BugInfos) | |
9.7.FP1 | |
Problem behoben lt. FixList in der Version | |
9.7.0.1 |