TOracleObject.Create with

zhives

Member
There are 2 types and a procedure in our database, created by the following commands:

create type X_Item as object (N number);
create type X_Table as table of X_Item;
create procedure MyProc (T in X_Table);

We'd like to pass an object from Delphi program to Oracle using the next code:

procedure ...
var OraObj: TOracleObject;
begin
OraObj := TOracleObject.Create(Sess, 'X_Table', '');
...
end;

But the Create method gives ORA-21560 error: argument name should not be null.
We did not find any idea in the help/manual.

I'm sure it is an easy problem but we can't solve it.
What is the mistake we made? Please help!

Best regards

Zoltan Hives
 
This works just fine when I try it. Could you let me know:
  • The Direct Oracle Access version you are using (I tried 3.4.5)
  • The Net8 and Oracle8 version (I tried 8.1.5)
  • If the Session is connected as the owner of the 'x_table' object type when you create the object instance

------------------
Marco Kalter
Allround Automations
 
Hi,

- DOA version: 3.3.1
- Database and Net8: 8.1.7 (WinNT)
- The code in our program:

procedure TfrmMain.Button1Click(Sender: TObject);
var
OraObj: TOracleObject;
begin
OraObj := TOracleObject.Create(osObject, 'X_Table', '');
try
; //Query.SetComplexVariable() etc.
finally
OraObj.Free;
end;
end;

- The error we get while calling the above Create method:
OCI-21560: argument 3 is null, invalid, or out of range

Thanks for help!

Zoltan Hives

Originally posted by mkalter:
This works just fine when I try it. Could you let me know:
  • The Direct Oracle Access version you are using (I tried 3.4.5)
  • The Net8 and Oracle8 version (I tried 8.1.5)
  • If the Session is connected as the owner of the 'x_table' object type when you create the object instance

 
I see. This looks like a problem that was fixed in 3.4.2, so you may want to upgrade to 3.4.

------------------
Marco Kalter
Allround Automations
 
We downloaded DOA 3.4.5 evaluation version, and would like to get some further help.
The mentioned TOracleObject.Create() method works fine in this version, but we can't write suitable code to pass array-like parameter to MyProc.

The question is that what method should we use to create OraObj containing integers from 1 to 10? We experimented with various statements (K is the counter in a FOR-loop):

1. AddElement;
Elements[MaxElements] := K;

2. SetAttr('N', K);

3. SetAttr('X_ITEM.N', K);

4. ItemObj := OraObj.ObjAttr('X_ITEM');
ItemObj.SetAttr('N', K);

All trials with the above statements resulted badly with various errors. We didn't find example in the manual to this exercise. Could you help us with it, please?
Any advice would be very helpful!

Thanks in advance,

Hives Zoltan

(Objects in the database, as we wrote in 1st letter:
create type X_Item as object (N number);
create type X_Table as table of X_Item;
create procedure MyProc (T in X_Table)
wink.gif


Originally posted by mkalter:
I see. This looks like a problem that was fixed in 3.4.2, so you may want to upgrade to 3.4.

 
Each element of your collection is an object of type 'x_item', with one attribute 'n'. Therefore, the code to fill 10 items could look like this:
Code:
Obj := TOracleObject.Create(MySession, 'x_table', '');
for i := 0 to 9 do
begin
  Obj.AddElement;
  Obj[i].SetAttr('n', i);
end;
For each element, the 'n' attribute is set to the value of i.

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