function MyFunction(vObj, vTest: TCouple): TResultat;
var
LOB11, LOB12, LOB14, lob17: TLobLocator;
qrySearch, qryList: TOracleQuery;
begin
qrySearch := TOracleQuery.Create(nil);
qrySearch.Session := OraSessionEtude2;
qryList := TOracleQuery.Create(nil);
qryList.Session := OraSessionEtude2;
qryList.SQL.Text := <....>;
qryList.DeclareVariable('vT4_C6', OtInteger);
qryList.DeclareVariable('vT4_C7', OtInteger);
try
qrySearch.SQL.AddStrings(qrySearch_.SQL);
qrySearch.DeclareAndSet('vT3_C6', OtInteger, vObj.poste);
qrySearch.DeclareAndSet('vT3_C7', OtInteger, vObj.cle);
qrySearch.DeclareAndSet('vT3_C8', OtInteger, vTest.Poste);
qrySearch.DeclareAndSet('vT3_C9', OtInteger, vTest.cle);
qrySearch.execute;
if qrySearch.rowcount > 0 then
begin
try
// Retrieve Result informations
<....>
// Retrieve LOB
LOB11 := qrySearch.LOBField('T3_C11');
if not LOB11.IsNull then
Result.item := LOB11.asString;
LOB12 := qrySearch.LOBField('T3_C12');
if not LOB12.IsNull then
Result.donnee := LOB12.asString;
LOB14 := qrySearch.LOBField('T3_C14');
if not LOB14.IsNull then
Result.Question := LOB14.asString;
LOB17 := qrySearch.LOBField('T3_C17');
if not LOB17.IsNull then
Result.Commentaire := LOB17.asString;
// on recupere les champs + les data
qryList.SetVariable('vT4_C6', qrySearch.fieldasInteger('T3_C1'));
qryList.SetVariable('vT4_C7', qrySearch.fieldasInteger('T3_C2'));
qryList.Execute;
while not qryList.Eof do
begin
// test pour compatibilite avec les anciennes versions
<...>
qryList.Next;
end;
qryList.Close;
finally
// Initialize Result with default value
<...>
LOB11.Clear;
LOB12.Clear;
LOB14.Clear;
lob17.Clear;
qrySearch.Close;
end;
end
else
begin
qrySearch.close;
// Initialize Result with default value
<...>
end;
finally
qrySearch.Clear;
FreeAndNil(qrySearch);
qryList.Clear;
FreeAndNil(qryList);
end;
end;