I want to add this member function to the type I created. I already altered the type.
I want to know what is the compilation error in this code and I want to know the solution for this?
This code is related to ORDB(Object Relational Database).
I have tried this changing the variables and I looked at syntaxes also.
CREATE OR REPLACE TYPE BODY Project_typ AS
MEMBER FUNCTION count_emp RETURN INTEGER
IS
MCOUNT INTEGER;
MANAGERcount INTEGER;
BEGIN
SELECT COUNT(SELF.mgr) INTO MANAGERcount
FROM Projects_tbl;
IF(MANAGERcount > 0){
SELECT COUNT(M.team_member) INTO MCOUNT
FROM Projects_tbl, TABLE(SELF.members) M
GROUP BY SELF.pname;
}
ELSE{
MCOUNT = -1;
}
END IF;
RETURN MCOUNT;
END count_emp;
END;
I am expecting to return a integer value.
If a manager is there, return the number of members working on that project.
If a manager is not there, return -1.