The following code creates an object table with a get_age function using oracle sql*plus.
Create Type C_type as Object(
Cname varchar(30),
dob Date,
classification Number,
sample_clip Blob
)
/
ALTER TYPE C_type
ADD MEMBER FUNCTION get_age RETURN INTEGER;
CREATE OR REPLACE TYPE BODY C_type AS
MEMBER FUNCTION get_age RETURN INTEGER IS
currenttime_age integer;
BEGIN
currenttime_age := (SYSDATE - dob)/365.25;
RETURN currenttime_age;
END get_age;
END;
/
my intention is to add another function that returns a character
- classification as ‘short’ (if below 5), ‘medium’ ( between 5-45 ) and ‘long’ (over 45)
Try this instead. My Bad.