SELECT papf.person_number employee_number
,ppn.full_name employee_name
,TO_CHAR(acc.procd_date,'DD-MON-YYYY','NLS_DATE_LANGUAGE = AMERICAN') transaction_date
,SUM(acc.value) balance
FROM per_all_people_f papf
,per_person_names_f ppn
,anc_per_acrl_entry_dtls acc
,anc_absence_plans_vl abpv
WHERE papf.person_id = ppn.person_id
AND TRUNC(SYSDATE) BETWEEN papf.effective_start_date AND papf.effective_end_date
AND TRUNC(SYSDATE) BETWEEN ppn.effective_start_date AND ppn.effective_end_date
AND ppn.name_type = 'GLOBAL'
AND acc.person_id = papf.person_id
AND abpv.absence_plan_id = acc.pl_id
AND abpv.name = 'XX Plan'
AND papf.person_number = '123456789'--:p_person_number
GROUP BY papf.person_number
,ppn.full_name