problem with pass array from Delphi to function

Nataly

Member
I need to pass array to procedure
example
CREATE TYPE TTEST AS VARRAY (100) OF VARCHAR(100);

FUNCTION TEST (V TTEST) RETURN STRING
IS
BEGIN
...
END;

How I possible to call that procedure from my Delphi programm?
I tryed

{Delphi code}
var tmpAr: variant;
tmpstr : string;
begin
tmpAr := VarArrayCreate([0,10], varVariant);
tmpAr[0]:='10';
tmpAr[1]:='20';

tmpstr := DMCommon.GSPackage.CallIntegerFunction('test', [tmpAr]);
end;

but error occured - PLS-00306: PLS-00306 wrong number or types of arguments
frown.gif
((

Why? Have I any possible to pass array?
 
A varray is a collection object, and is encapsulated by the TOracleObject class (so you will need the Direct Oracle Access Object Version). To call a function with an object parameter or result, you cannot use the TOraclePackage component, which is restricted to scalar data types due to its simplified interface.

Instead, you can either use a TOracleQuery with a simple PL/SQL Block that calls this function with an Object parameter, or you can generate a class for your package through the Package Wizard.

In both cases the collection object is represented by a TOracleObject instance.

------------------
Marco Kalter
Allround Automations
 
Thank you! But I have a new problem
frown.gif

I use TOracleQuery in thise case,
I have type
CREATE TYPE TTEST AS VARRAY (10) OF VARCHAR(100);
in PL/SQL block
and create array in Delphi
a:=VarArrayCreate([0,9], varVariant);

When I do Query.Execute; the next error occures "All arrays must be of equal size for Array DML"
 
Back
Top