SELECT user_name
      ,paf2.person_id  approver_personid
      ,paf2.full_name  approver_fullname
      ,recipient_role  user_name
      ,wn.begin_date
      ,wn.status
      ,wn.subject
      ,wn.message_name
  FROM per_all_assignments_f paaf
      ,per_all_people_f      paf1
      ,per_jobs              pjb
      ,per_positions         ppo
      ,per_all_people_f      paf2
      ,fnd_user              fu
      ,wf_notifications      wn
 WHERE paaf.person_id = paf1.person_id
   AND paaf.supervisor_id = paf2.person_id
   AND paaf.job_id = pjb.job_id(+)
   AND paaf.position_id = ppo.position_id(+)
   AND (SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date)
   AND (SYSDATE BETWEEN paf1.effective_start_date AND paf1.effective_end_date)
   AND (SYSDATE BETWEEN paf2.effective_start_date AND paf2.effective_end_date)
   AND fu.employee_id = paf2.person_id
   AND wn.recipient_role = fu.user_name

Deixe um comentário