Professional Documents
Culture Documents
Zumi 11
Zumi 11
1. MEMBER METHODS
• Create an object type EMP_TYPE having: ATTRIBUTES v_ename varchar2(10) v_sal number
v_job varchar2(10) MEMBER METODS member procedure info(p_empno in number) member
procedure display
• Define the member methods in the object type body as follows: EMPNO must be passed as input
parameter in member procedure INFO. ENAME, SAL and JOB of the input EMPNO must be fetched
in the member attributes. Procedure DISPLAY will display the values of the member attributes.
• Create an instance of the object type in anonymous block and display the ENAME,SAL and JOB
of any employee number using member methods.
2. STATIC METHODS
• Create an object type EMP_TYPE having: ATTRIBUTES v_ename varchar2(10) v_sal number
v_job varchar2(10) STATIC METHOD static procedure info(p_empno in number,p_ename out
varchar2,p_sal out number,p_job out varchar2) MEMBER METOD member procedure display
• Define the methods in the object type body as follows: EMPNO must be passed as input
parameter in static procedure INFO. ENAME, SAL and JOB of the input EMPNO must be returned
from the procedure. Procedure DISPLAY will display the values of the member attributes.
• Create an instance of the object type in anonymous block and display the ENAME,SAL and JOB
of any employee number using defined methods.
3. CONSTRUCTORS
Create an object type EMP_TYPE having: ATTRIBUTES v_ename varchar2(10) v_sal number
v_job varchar2(10)
• Define the methods in the object type body as follows: EMPNO must be passed as input
parameter in constructor function EMP_TYPE. ENAME and HIREDATE of the input EMPNO must
be returned from the constructor as SELF. SELF and second instance will be passed as parameters in
order member function COMPARE. -1 will be returned if the hiredate of SELF instance is less than
the hiredate of the second instance else 1 will be returned. Procedure DISPLAY_SENIOR will display
the ENAME and HIREDATE of the employee.
• Create two employees instances of the object type EMP_TYPE in anonymous block and
initialized them using defined constructor. Now compare both the employees instances using ORDER
member function and display the ENAME and HIREDATE of the senior most employee using
DISPLAY_SENIOR member procedure.