CREATE TYPE MojTyp AS OBJECT(id        NUMBER(3),
  nazwa    VARCHAR2(20),
  telefon       NUMBER(9),
  MEMBER FUNCTION identyfikator(znakow NUMBER) RETURN VARCHAR2
  INSTANTIABLE NOT FINAL;
/

CREATE TYPE BODY MojTyp IS   
  MEMBER FUNCTION identyfikator(znakow NUMBER) RETURN VARCHAR2 IS 
    BEGIN 
      RETURN (SUBSTR(nazwa,1,znakow));
    END; 
  END; 
/
