TLobLocator: Invalid handle in some databases.

Arvid

Member²
I have following function:

var
lComplex: TLOBLocator;
Data: TFileStream;
begin

try
logg('Response received from server - for soap message');

Data := TFileStream.Create('D:\Elwin\Test kode\Webserver\NUBIX\xml\SettInn.xml.txt', fmOpenRead);

Data.Position := 0;

logg('Stream read from server.');

lComplex := TLOBLocator.Create(OracleSession1, otClob);

OracleQuery1.DeleteVariables;
OracleQuery1.DeclareVariable(':RESPSTREAM', otCLOB);
OracleQuery1.SetComplexVariable(':RESPSTREAM', lComplex);
OracleQuery1.Sql.Text := 'UPDATE web.ewsendsoap set SVAR = sysdate WHERE ID = 3 returning RESPONSE into :RESPSTREAM';
logg('Run SQL: '+OracleQuery1.Sql.Text);
OracleQuery1.Execute;
logg('Prepare to load response XML.');
logg('Response storleik: '+IntToStr(Data.Size));
/// Copy to XML to the database
lComplex.CopyFrom(Data, Data.Size);
FreeAndNil(lComplex);
OracleQuery1.Session.Commit;
logg('Data inserted in web.ewsendsoap!!!');
finally
if Data nil then FreeAndNil(Data);
if lComplex nil then FreeAndNil(lComplex);
end;

When I come to the line: lComplex.CopyFrom(Data, Data.Size); I get the error message "TLobLocator: Invalid handle".

I have tested this on two databases with the exact same table. Both version 10.2.0.3.0.

It works on one database - but it fails on the other. Any idea why???
 
Last edited:
Found the problem.

For some reason the insert I did:
insert into web.ewsendsoap
(.., response, ...)
values
(...,
empty_clob(),
...);

did not insert "emtpy_clob()" on all databases. I inserted the following code before the update above:

oracleQuery1.Clear;
OracleQuery1.Sql.Text := 'UPDATE web.ewsendsoap set RESPONSE = empty_clob() WHERE ID = 1';
OracleQuery1.execute;

Then it works on both databases... Strange, but it works...
 
Back
Top