Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    2

    Unanswered: Reading a BLOB column containing XML data using SELECT

    Hello all,

    I'm trying to read a column defined as BLOB in a DB2 table. The column contains XML data. Attached image file is the table definition of the table containing the BLOB column.

    Click image for larger version. 

Name:	Selection_004.png 
Views:	4 
Size:	6.2 KB 
ID:	16139

    I have tried the following SELECT queries but couldn't make progress. Below are the queries with error messages. Any help on how to read this column would be greatly appreciated.
    Code:
    db2 => SELECT XMLCAST(XMLPARSE (DOCUMENT ITD_BLOB PRESERVE WHITESPACE) as XML) FROM DB2INST1.TCTG_ITD_ITEM_DETAIL 
    WHERE ITD_NEXT_VERSION_ID = 999999999 AND ITD_ITEM_ID = 476802
    
    SQL16103N  A character was found in an XML document that is invalid or cannot
    be represented in the document encoding.  SQLSTATE=2200M
    Code:
    db2 => SELECT XMLCAST(XMLPARSE (DOCUMENT '<?xml version="1.0" encoding="iso-8859-1"?>' ITD_BLOB PRESERVE WHITESPACE) as XML) 
    FROM DB2INST1.TCTG_ITD_ITEM_DETAIL WHERE ITD_NEXT_VERSION_ID = 999999999 AND ITD_ITEM_ID = 476802
    
    SQL0104N  An unexpected token "ITD_BLOB" was found following
    "ng=''iso-8859-1''?>'".  Expected tokens may include:  "<space>".  SQLSTATE=42601

    Best regards,

    -Naveen.

  2. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hello,

    Code:
    $ db2 "? sql16103"
    
    SQL16103N  A character was found in an XML document that is invalid or
          cannot be represented in the document encoding.
    
    Explanation: 
    
    While parsing an XML document the parser found a character that was
    invalid or is not represented in the document encoding.
    
    Parsing did not complete.
    
    User response: 
    
    Correct the XML document and try the operation again.
    Regards,
    Mark.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •