Good evening
1. How do I typecast one instance of TOracleObject to another with other type (ancestor to descendant)?
2. How do I use sys.anydata type with DOA 4.0?
3. I have a problem when I tryed to assign an Oracle Object descendant represented by TOracleObject to ancestor.
Problem decription.
I have the followning types in Oracle 10g DB:
create or replace type TAncestor as object
(
stub char(1)
) not final;
/
create or replace type TDescendant under TAncestor
(
FValue varchar2(4000)
);
In a Delphi7 I have the following code:
procedure TestAssign(Session: TOracleSession);
var
S, D, T: TOracleObject;
begin
T := TOracleObject.Create(Session, 'TAncestor', '');
S := TOracleObject.Create(Session, 'TDescendant', '');
D := TOracleObject.Create(Session, 'TDescendant', '');
S.SetAttr('FValue', 'yes');
T.Assign(S);
D.Assign(T);
// And D.AttrByName('FValue') not equal 'yes'.
// D.AttrByName('FValue') is ''.
FreeAndNil(S);
FreeAndNil(T);
FreeAndNil(D);
end;
Why does D.AttrByName('FValue') return '' instead of 'yes'?
1. How do I typecast one instance of TOracleObject to another with other type (ancestor to descendant)?
2. How do I use sys.anydata type with DOA 4.0?
3. I have a problem when I tryed to assign an Oracle Object descendant represented by TOracleObject to ancestor.
Problem decription.
I have the followning types in Oracle 10g DB:
create or replace type TAncestor as object
(
stub char(1)
) not final;
/
create or replace type TDescendant under TAncestor
(
FValue varchar2(4000)
);
In a Delphi7 I have the following code:
procedure TestAssign(Session: TOracleSession);
var
S, D, T: TOracleObject;
begin
T := TOracleObject.Create(Session, 'TAncestor', '');
S := TOracleObject.Create(Session, 'TDescendant', '');
D := TOracleObject.Create(Session, 'TDescendant', '');
S.SetAttr('FValue', 'yes');
T.Assign(S);
D.Assign(T);
// And D.AttrByName('FValue') not equal 'yes'.
// D.AttrByName('FValue') is ''.
FreeAndNil(S);
FreeAndNil(T);
FreeAndNil(D);
end;
Why does D.AttrByName('FValue') return '' instead of 'yes'?