Using packages causes excessive parse calls

Gaute

Member
We are using Delphi 2005 with DOA 4.0.2. When we are calling functions/procedures from packages Oracle seems to be parsing my the calls every time I access it. How can I avoid this?

Our package unit looks like this:
procedure TQbLogic.Questionhaslogic(Qid: Double; Vid: Double; out Lid: Double;
out Title: string);
begin
GetQuery;
OCPQuery.DeclareVariable('QID', otFloat);
OCPQuery.SetVariable('QID', Qid);
...
OCPQuery.SQL.Add('begin');
OCPQuery.SQL.Add(' "QB_LOGIC"."QUESTIONHASLOGIC"(');
OCPQuery.SQL.Add(' QID => :QID,');
OCPQuery.SQL.Add(' VID => :VID,');
OCPQuery.SQL.Add(' LID => :LID,');
OCPQuery.SQL.Add(' TITLE => :TITLE);');
OCPQuery.SQL.Add('end;');
OCPQuery.Execute;
 
If you want to optimize this to reduce parsing, you need to allocate a dedicated TOracleQuery and only set variable values between calls. The TOraclePackage class uses one TOracleQuery instance for all calls, and therefore a parse is done for each call.
 
Back
Top