Use to record in the database is someone else's stored procedure
'begin' + #13#10 +
' pkg_x.insert(md1 => :md1,' + #13#10 +
' md2 => :md2,' + #13#10 +
' cnt => :cnt);' + #13#10 +
'end;';
where cnt is the size of the arrays md1, md2 arrays of numbers. Their type is defined in Oracle as is table of number index by binary_index.
Previously used components are DOA and passed the arrays like this:
md1:= VarArrayCreate([0, 99], varVariant);
md2 := VarArrayCreate([0, 99], varVariant);
--------
DeclareVariable('md1', otInteger);
DimPLSQLTable('md1', 100, 0);
DeclareVariable('md2 ', otInteger);
DimPLSQLTable('md2 ', 100, 0);
DeclareVariable('cnt', otInteger);
SetVariable('cnt', 100);
SetVariable('md1', md1);
SetVariable('md2', md2);
Execute;
performed as expected.
Now is DOA TOracleQuery need to use a FireDac TFDQuery as cross-platform everything. Decided to use the technology of array DML.
SetLength(md1, 100);
SetLength(md2, 100)
-------------------;
FDQuery.ParamByName('md1').DataType:= ftInteger;
FDQuery.ParamByName('md2').DataType:= ftInteger;
FDQuery.ParamByName('cnt').AsInteger:= 100;
FDQuery.Params.ArraySize:= 100;
for I := 0 to 99 do
begin
FDQuery.ParamByName('md1').Values[I]:= md1[i];
FDQuery.ParamByName('md2').Values[I]:= md2[i];
end;
FDQuery.Execute(FDQuery.Params.ArraySize);
as the note says that the varray is not supported, then what? Stored procedure to change only in very extreme cases. When this query fails the DB: the number or types of parameters are incorrect