CREATE OR REPLACE TYPE BODY CityORType
AS
  MEMBER FUNCTION Distance (other IN CityORType)
  RETURN NUMBER
  IS
  BEGIN
     RETURN SELF.coordinates.distance(other.coordinates);
  END;
  MEMBER FUNCTION NoOfOrganizations
  RETURN NUMBER
  IS
  n NUMBER;
  BEGIN
    SELECT count(*)
    INTO n
    FROM Organization o
    WHERE o.city = SELF.name AND o.province=SELF.province AND o.country=SELF.country;
    RETURN n;
END; END;
/
