TLobLocator: Invalid Handle when TLobLocater.Free

phoenix610

Member²
When TLobLocator.IsNull is true, TLobLocator.Free method raises Invalid Handle error.

Sample code is below

while True do
begin
Lob := FDbmsMetadata.FetchClob(Handle);
try
if Lob.IsNull then
Break;
//
finally
// Lob.Clear;
Lob.Free;
end;
end;

// DBMS_METADATA.FETCH_CLOB
function TDbmsMetadata.FetchClob(const AHandle: Variant): TLOBLocator;
begin
Result := TLOBLocator.CreateTemporary(Session, otCLOB, True);
try
GetQuery;
OCPQuery.DeclareVariable('function_result', otCLOB);
OCPQuery.SetComplexVariable('function_result', Result);
OCPQuery.DeclareVariable('HANDLE', otFloat);
OCPQuery.SetVariable('HANDLE', AHandle);
OCPQuery.SQL.Add('begin');
OCPQuery.SQL.Add(' :function_result := "DBMS_METADATA"."FETCH_CLOB"(');
OCPQuery.SQL.Add(' HANDLE => :HANDLE);');
OCPQuery.SQL.Add('end;');
OCPQuery.Execute;
except
Result.Free;
raise;
end;
end;

By invoking TLobLocator.Clear method before invoking TLobLocater.Free, I can avoid this error.
I always need to invoke Clear method before Free method??

DOA 4.0.7.1
Delphi 2005
Oracle 10.2.0.1.0
 
I always need to invoke Clear method before Free method??
Shouldn't be necessary. The handle of the TLOBLocator is cerated when the TLOBLocator is created, and should be freed again when the instance is freed.

What is your exact Oracle Client version?
 
oh. this is oracle version issue?
anway, its ok with me because i can avoid this issue by invoking TLobLocator.Clear method.
I just wanteted know whether what causes this error.

pls look at this thread ttp://www.allroundautomations.com/ubb/ultimatebb.php?ubb=get_topic;f=1;t=002736
he is using Oracle 9i. so i dont think this is oracle bug.so if u have internal bug tracking system. pls add this to it to fix in furute relase.
 
I get the same problem with Oracle 12.
Is it really an Oracle bug that surface in Oracle 12 again?

 
Back
Top