Hello,

i have tried to create table with field of object datatypes, table created and values inserted successfully, but when retriving data it gives null values,

will you please gave me a solution for this,


--creating object type....


DROP TYPE ITG4802.Obj_Person;

CREATE TYPE ITG4802.Obj_Person AS
(
name VARCHAR(25)
,age INT
)MODE DB2SQL;


--creating table of object type..

DROP TABLE ITG4802.PERSON_TAB;

CREATE TABLE ITG4802.PERSON_TAB OF ITG4802.Obj_Person(REF IS pid USER GENERATED);

--
--where pid is unique.

--insertion..

INSERT INTO ITG4802.PERSON_TAB VALUES(Obj_Person('1'),'RAKHI',23);
INSERT INTO ITG4802.PERSON_TAB VALUES(Obj_Person('12'),'KRISHNA',22);



--Retrival..


Select * FROM ITG4802.PERSON_TAB;

Select * FROM ITG4802.PERSON_TAB WHERE pid = Obj_Person('1');


--upto here executed successfully

-- When i used that object type as a datatype in a table creation, it get created but insertion and
-- retrival are executed but they give null values.

--creating table having field of Obj_Person datatype


DROP TABLE ITG4802.EMP_OBJ;

CREATE TABLE ITG4802.EMP_OBJ
(
eid int
,details Obj_Person
);

--table created

SELECT eid,Obj_Person()..name AS NAME,Obj_Person()..age AS AGE FROM ITG4802.EMP_OBJ;


--inserting values

INSERT INTO ITG4802.EMP_OBJ(eid,details)
VALUES(124,Obj_Person()..name('krishna')..age(25)) ;

INSERT INTO ITG4802.EMP_OBJ(eid,details)
VALUES(1254,Obj_Person()..name('Rama')..age(23));

--
--
-- Retriving data

SELECT eid,Obj_Person()..name AS NAME,Obj_Person()..age AS AGE FROM ITG4802.EMP_OBJ;

-- it returns only 'eid' values,but remianing field values are shown as null's.