1

When ever I run my Pro*C code which insert a large buffer to table using CLOB.

ORA-24811:While writing into a LOB, less data was provided than indicated.

code is below

OCIClobLocator *lob;  
...  
EXEC SQL insert into TAB (MSG,STATUS ,ERROR_DESC ,ACCESS_DATE   )  
       values   (empty_clob(),:status,:error_desc,:sys_date_time);  
    /* Allocate and Initialize the Locator: */  
EXEC SQL ALLOCATE :lob;  
printf("CLOB Allocated\n");  
EXEC SQL SELECT MSG INTO :lob  
      FROM TAB WHERE STATUS = :status FOR UPDATE;  

/***opening the CLOB***/  
EXEC SQL LOB OPEN :lob READ WRITE;  
/*** writing to clob ***/  
printf("messlen:%d, actual string length:%d\n",messlen,strlen(buffer));  
EXEC SQL LOB WRITE ONE :messlen FROM :buffer INTO :lob;  
SYS_CHECK_SQL_ERROR  

output

    CLOB Allocated  
    messlen:6348, actual string length:6348  
    ***** ERROR sqlca=|-24811|*****

buffer has a large xml file. Can anyone explain what i'm missing?

0 Answers0