Using TOraRef as parameters
Posted: Thu 29 Jun 2006 14:26
Hi All.
May I use out parameter of TOraRef type of TOraSQL as In parameter in another TOraSQL?
I have:
--------------------------------------------------
create type base_typ as object
(
name varchar2(32)
)not final;
create type property_typ as object
(
entity ref base_typ
val float
)not final;
create table base_t of base_typ;
create table property_t of property_typ;
--------------------------------------------------
OraSQL1: TOraSQL1
OraSQL1.SQL =
'insert into base_t t values(:nam) returning REF(t) into :res'
OraSQL2: TOraSQL2
OraSQL2.SQL =
'insert into property_t t values(:obj, :val)'
--------------------------------------------------
And following code:
...
t := TOraType.Create(Session.OCISvcCtx, 'base_t');
OraSQL1.ParamByName('Res').AsRef.ObjectType := t;
t.Free;
OraSQL1.ParamByName('Nam').AsString := 'String';
OraSQL1.Execute;
OraSQL2.ParamByName('obj').AsRef := OraSQL1.ParamByName('Res').AsRef;
OraSQL2.ParamByName('Val').AsFloat := 100;
OraSQL2.Execute;
...
I have no error, but in property_t table field entity is Null.
What's wrong?
Thanx
May I use out parameter of TOraRef type of TOraSQL as In parameter in another TOraSQL?
I have:
--------------------------------------------------
create type base_typ as object
(
name varchar2(32)
)not final;
create type property_typ as object
(
entity ref base_typ
val float
)not final;
create table base_t of base_typ;
create table property_t of property_typ;
--------------------------------------------------
OraSQL1: TOraSQL1
OraSQL1.SQL =
'insert into base_t t values(:nam) returning REF(t) into :res'
OraSQL2: TOraSQL2
OraSQL2.SQL =
'insert into property_t t values(:obj, :val)'
--------------------------------------------------
And following code:
...
t := TOraType.Create(Session.OCISvcCtx, 'base_t');
OraSQL1.ParamByName('Res').AsRef.ObjectType := t;
t.Free;
OraSQL1.ParamByName('Nam').AsString := 'String';
OraSQL1.Execute;
OraSQL2.ParamByName('obj').AsRef := OraSQL1.ParamByName('Res').AsRef;
OraSQL2.ParamByName('Val').AsFloat := 100;
OraSQL2.Execute;
...
I have no error, but in property_t table field entity is Null.
What's wrong?
Thanx