I need to determine the type of the Employee object that will have some attributes, then I have to define the type manager of the object that inherits the Employee type and will have the aditional attribute called nrEmp, which will contain the number of employees each manager has under his command. I also have to implement the ORDER method for the type manager, so I can order managers by the number of employees they have. First I defined this type:
CREATE OR REPLACE TYPE Departament AS OBJECT ( deptno NUMBER(2), dname CHAR(14) );
Next, I defined the type of Employee:
CREATE OR REPLACE TYPE Employee AS OBJECT ( empno NUMBER(4), ename CHAR(10), dept REF Departament, sal NUMBER(7,2) ) NOT FINAL;
So far, everything has been working fine. Then I will try to determine the type of Manager:
CREATE OR REPLACE TYPE Manager UNDER Employee ( nrEmp INTEGER, ORDER MEMBER FUNCTION compare(m Manager) RETURN INTEGER );
When I do this, I get the following error:
Error(1,1): PLS-00646: MAP or ORDER method must be defined in the root of the subtype hierarchy
As I understand it, I need to declare a method in type Employee. But I'm not sure how to do it right. Could not find any example showing how to implement the ORDER method on inheritance. Any help would be greatly appreciated. Thanks.
inheritance sql oracle plsql oracle11g
Zan
source share