Thursday, 26 August 2021

Query to Fetch Business Unit in Cloud

select haou.name as business_unit,
paam.person_id
from hr_org_unit_classifications_f houcf
, hr_all_organization_units haou
,per_all_assignments_m paam
,per_periods_of_service ppos
where
1=1
and houcf.organization_id = haou.organization_id
and paam.organization_id= haou.organization_id
and PPOS.PERIOD_OF_SERVICE_ID= PAAM.PERIOD_OF_SERVICE_ID
and houcf.classification_code= 'DEPARTMENT'
and houcf.status = 'A' 
AND paam.assignment_type IN ('E','C')
AND paam.effective_latest_change = 'Y' 
and paam.assignment_status_type IN ('ACTIVE','SUSPENDED')
and ppos.ACTUAL_TERMINATION_DATE is null
and :EFFECTIVE_DATE BETWEEN Paam.EFFECTIVE_START_DATE AND Paam.EFFECTIVE_END_DATE
and :EFFECTIVE_DATE BETWEEN haou.EFFECTIVE_START_DATE AND haou.EFFECTIVE_END_DATE
and :EFFECTIVE_DATE BETWEEN houcf.EFFECTIVE_START_DATE AND houcf.EFFECTIVE_END_DATE

No comments:

Post a Comment