Query to fetch organization hierarchy in Fusion HCM

SELECT per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep0_pk1_value,'name')  dept,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep22_pk1_value,'name') l10,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep23_pk1_value,'name') l9,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep24_pk1_value,'name') l8,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep25_pk1_value,'name') l7,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep26_pk1_value,'name') l6,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep27_pk1_value,'name') l5,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep28_pk1_value,'name') l4,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep29_pk1_value,'name') l3,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep30_pk1_value,'name') l2,
       per_extract_utility.GET_BY_PRIMARY_KEY('hr_organization_units','organization_id', dep31_pk1_value,'name') l1,
       dep0_pk1_value                                                                                            org_id
FROM   per_org_tree_node_cf
WHERE  1=1
AND    tree_structure_code = 'PER_ORG_TREE_STRUCTURE'
AND    tree_code =' '    -- Org Tree Code
AND    dep0_pk1_value = --- ORG ID from where ORG TREE is required==> Parent

No comments:

Post a Comment