Reputation: 87
I am trying to get acquainted to using LOBs in Oracle (coming from RdB which should be migrated). I now face a problem when I try to make an update on an existing entry with a CLOB column named AN.BEMERKUNG:
Code extract:
OCIClobLocator *clob ;
long bufsize=20, start=1 ;
long anz_inserted=0, anz_to_insert=0 ;
long len ;
char buffer[20], *ptr ;
ptr = new_value ; // char *new_value, allocated
anz_inserted = 0 ;
len = strlen(new_value)+1 ;
EXEC SQL ALLOCATE :clob ;
EXEC SQL SELECT NVL(bemerkung, EMPTY_CLOB()) INTO :clob FROM AN WHERE AN.ID = :(an_ptr->an_id) ;
while (anz_inserted < len)
{
anz_to_insert = len-anz_inserted>bufsize?bufsize:len-anz_inserted ;
memcpy(buffer, ptr, anz_to_insert) ;
if (anz_inserted == 0)
{
if (len == anz_to_insert)
{
EXEC SQL LOB WRITE ONE :len FROM :buffer INTO :clob at :start ;
}
else
{
EXEC SQL LOB WRITE FIRST :anz_to_insert FROM :buffer INTO :clob at :start ;
}
}
else
{
if (anz_inserted + anz_to_insert < len)
{
EXEC SQL LOB WRITE NEXT :anz_to_insert FROM :buffer INTO :clob ;
}
else
{
EXEC SQL LOB WRITE LAST :anz_to_insert FROM :buffer INTO :clob ;
}
}
anz_inserted += anz_to_insert ;
ptr += anz_to_insert ;
}
Everything works fine up to the moment I try a commit, I then get the message:
returned sqlcode -3113 from commit
SQL error message: ORA-03113: end-of-file on communication channel
I am using Oracle 11 on RHEL. The program is running directly on the platform where the DB is located. I am using this small buffer size of 20 just for test purpose, to force the program to build the CLOB in several steps.
What might this error result from?
Upvotes: 0
Views: 821
Reputation: 14385
Generally, when you get an ORA-03113
error, it means the connection to the database was terminated unexpectedly and the client (your program) can no longer communicate with the database.
So, the error (apparently) happened on the server side. So, check the alert log around the time of the ORA-03113
error, and see if there are any errors in the alert log at that time. That should give you a clue as to the root cause.
Upvotes: 0