Unanswered: Fetching the blob data for a dynamic SQL in DB2
I am using IBM DB2 7.2 and 8.1 version on windows platform. My application fetch the blob/clob data from the database using following statement:
EXEC SQL FETCH Cursor0 USING DESCRIPTOR :*pstr;
The problem using above statement is that , I need to pass the buffer of size equal to the length of field configured at database. Suppose, I have configured a blob or clob field of table as 2GB. But I stored data of size 2KB. To fetch the data, I currently allocate the buffer pstr of size 2GB.
My problem is how to get the length of exact data in the field before passing a buffer to pstr.
In oracle, we get the blob data using following statement
EXEC SQL LOB DESCRIBE :a_clob GET LENGTH INTO :col_len;
EXEC SQL LOB READ :len
FROM :a_clob AT ff
INTO :sr_buff2 WITH LENGTH :len;
Or any other way to retrieve the blob/clob data is highly appreciable.