create or replace FUNCTION REC_APP_ROLE(
    P_EMPLOYEE_ID HRIS_EMPLOYEES.EMPLOYEE_ID%TYPE,
    P_RECOMMENDER_ID HRIS_RECOMMENDER_APPROVER.RECOMMEND_BY%TYPE,
    P_APPROVER_ID HRIS_RECOMMENDER_APPROVER.APPROVED_BY%TYPE )
  RETURN VARCHAR2
IS
  V_ROLE_TYPE NUMBER;
BEGIN
  IF(P_EMPLOYEE_ID = P_RECOMMENDER_ID AND P_EMPLOYEE_ID = P_APPROVER_ID)THEN
    V_ROLE_TYPE   :=4;
  ELSE
    IF(P_EMPLOYEE_ID = P_RECOMMENDER_ID) THEN
      V_ROLE_TYPE   :=2;
    END IF;
    IF(P_EMPLOYEE_ID= P_APPROVER_ID) THEN
      V_ROLE_TYPE  :=3;
    END IF;
  END IF;
RETURN V_ROLE_TYPE;
END;