How to select CLOB data type data from db2

db2, sql, xml

Solution

I have done something like the following.

select cast(CLOBCOLUMN as varchar(32000)) 
  from TABLENAME where cast(TABLENAME.CLOBCOLUMN as      
   varchar(32000)) like '%AString%' for read only;

Problem

``` SELECT CAST (ATTCH_BODY AS CLOB(30720)) INTO :WS-ATTCH-BODY FROM NBASRDOCUM 05 WS-ATTCH-BODY SQL TYPE IS CLOB(32K). ``` When I am trying to select `clob` data using above query, it shows all zeros (0) in the variable. Please recommend me how to select `clob` data type. Actually I've inserted a text file with 2k size from GUI into that variable (`ATTCH_BODY`). I need to send it back to GUI using XML strings.

Original source