Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select CLOB data type data from db2

Tags:

sql

xml

db2

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.

like image 652
user1845010 Avatar asked Nov 22 '12 12:11

user1845010


1 Answers

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;
like image 114
nate_weldon Avatar answered Sep 22 '22 02:09

nate_weldon