Array insert

AndreyB

Member²
I've discovered very interesting problem during massive array insert in TOracleQuery.
I have query variable as array of variant and between execution I could change its size (like at first execute it was 10 elements and at the second only one). Sometimes different errors generated like "access violation in oracommon8.dll", "cannot insert null into...", "value to large for specified column". OracleMonitor shows all variables with properly assigned values (none of them could lead to the above messages). Then I found this in your TOracleQuery.Parse method

// Because of a bug in Net8, we need to reparse when a long, long raw or array variable is used
if Session.UseOCI80 then
begin
for i := 0 to Variables.Count - 1 do
begin
VarData := Variables.Data(i);
if (VarData.BufType in [otLong, otLongRaw]) or
(VarData.IsPLSQLTable) or
(VarData.ArraySize > 1) then ParsedSQL := '';
end;
end;

Accordingly to the comment in case of array bind variables the statement should be reparsed. But if I set variable as an array of size 1 it will not, because arraysize in that case is 1, but during the previous execution it was 10 for instance. That lead to different errors during OciStmtExecute. The only way to fix that problem is to set Optimize for such queries to False, that force reparsing every time.
But I believe such situation should be handled in TOracleQuery as well.
 
You are right, if the array size changes from >1 to 1, the statement should be reparsed. We will fix this, and until then you can use your work around and set the Optimize property to False.

------------------
Marco Kalter
Allround Automations
 
Back
Top