All Forums Tools
WAQ 158 posts Joined 02/10
11 Jan 2016
Issue with importing CLOB data using BTEQ

Hi, I have a simple BTEQ script (given below) to load CLOB data in an empty table.

.LOGON ;

DELETE FROM TTE ALL;

.IMPORT INDICDATA FILE = C:\TEST\Data_Clob;
USING (LOBTYPE CLOB(1000000000))
INSERT INTO TTE ('1', :LOBTYPE);

.LOGOFF;

When I execute the script, I get the below error:
 *** Error: The following occurred during an Access Module read:
 Unexpected data format.
 *** Warning: Out of data.
 *** Warning: EOF on INPUT stream.

Fred 1096 posts Joined 08/04
11 Jan 2016

With INDICDATA, the file is expected to be in "FastLoad format" with binary length fields and NULL indicator bits at the start. And since you have not said otherwise, BTEQ will expect the CLOB data (up to 32K) to be in-line as a VARCHAR column.
Consider using something like
 
.IMPORT VARTEXT DEFERCOLS=1 FILE=C:\TEST\Lob_List;
USING (LOBTYPE CLOB(1000000000) AS DEFERRED BY NAME)
INSERT INTO TTE('1',:LOBTYPE);
 
Where Lob_List is a text file containing the filename for LOB data.

WAQ 158 posts Joined 02/10
12 Jan 2016

Thanks a lot Fred. The code you provided is working as expected.
Thanks and Regards.

You must sign in to leave a comment.