I ve a below structured object TYPE in Oracle to calculate the Simple and Compound interest for an amount..
CREATE TYPE pnr_typ AS OBJECT
MEMBER FUNCTION si RETURN FLOAT,
MEMBER FUNCTION ci RETURN FLOAT,
MEMBER FUNCTION prod(invent NUMBER) RETURN NUMBER
CREATE TYPE BODY pnr_typ IS
MEMBER FUNCTION si RETURN FLOAT IS
END; MEMBER FUNCTION ci RETURN FLOAT IS
RETURN POWER(SELF.principle*(1 + SELF.interest/100), year);
MEMBER FUNCTION prod (invent NUMBER) RETURN NUMBER IS
RETURN (year + invent);
With in the TYPE i define some attributes like principle, interest, year and more member functions like si, ci, prod to access and modify the TYPE attributes.
This TYPE can be used in
* the column definition while creating a column in a table,
* the procedures or Oracle DB objects as an instance
I would like to know if the TYPE (structured) in DB2 can do the same as the above Oracle TYPE.