继承例子,注意只有9i开始支持:
Type Hierarchy Example
The following statements creates a type hierarchy. Type employee_t inherits the name and ssn attributes from type person_t, and in addition has department_id and salary attributes. Type part_time_emp_t inherits all of the attributes from employee_t and, through employee_t, those of person_t, and in addition has a num_hrs attribute. Type part_time_emp_t is final by default, so no further subtypes can be created under it.:CREATE TYPE person_t AS OBJECT (name VARCHAR2(100), ssn NUMBER)
NOT FINAL;CREATE TYPE employee_t UNDER person_t
(department_id NUMBER, salary NUMBER) NOT FINAL;CREATE TYPE part_time_emp_t UNDER employee_t (num_hrs NUMBER);
Type Hierarchy Example
The following statements creates a type hierarchy. Type employee_t inherits the name and ssn attributes from type person_t, and in addition has department_id and salary attributes. Type part_time_emp_t inherits all of the attributes from employee_t and, through employee_t, those of person_t, and in addition has a num_hrs attribute. Type part_time_emp_t is final by default, so no further subtypes can be created under it.:CREATE TYPE person_t AS OBJECT (name VARCHAR2(100), ssn NUMBER)
NOT FINAL;CREATE TYPE employee_t UNDER person_t
(department_id NUMBER, salary NUMBER) NOT FINAL;CREATE TYPE part_time_emp_t UNDER employee_t (num_hrs NUMBER);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货