SELECT
LPAD (' ', 5 * LEVEL) || has.NAME hierarchy,
LEVEL,
hap.NAME parent_name,
pse.parent_position_id,
has.NAME child_name,
pse.subordinate_position_id
FROM
(SELECT NAME, position_id
FROM hr_all_positions_f_tl
WHERE LANGUAGE = USERENV ('LANG')) hap,
(SELECT NAME, position_id
FROM hr_all_positions_f_tl
WHERE LANGUAGE = USERENV ('LANG')) has,
per_pos_structure_elements pse
WHERE pse.business_group_id = 81
AND hap.position_id = pse.parent_position_id
AND has.position_id = pse.subordinate_position_id
start with pse.parent_position_id = 40979
CONNECT BY PRIOR pse.subordinate_position_id = pse.parent_position_id
AND PRIOR pse.pos_structure_version_id = pse.pos_structure_version_id
AND PRIOR pse.business_group_id = pse.business_group_id
ORDER BY 4
LPAD (' ', 5 * LEVEL) || has.NAME hierarchy,
LEVEL,
hap.NAME parent_name,
pse.parent_position_id,
has.NAME child_name,
pse.subordinate_position_id
FROM
(SELECT NAME, position_id
FROM hr_all_positions_f_tl
WHERE LANGUAGE = USERENV ('LANG')) hap,
(SELECT NAME, position_id
FROM hr_all_positions_f_tl
WHERE LANGUAGE = USERENV ('LANG')) has,
per_pos_structure_elements pse
WHERE pse.business_group_id = 81
AND hap.position_id = pse.parent_position_id
AND has.position_id = pse.subordinate_position_id
start with pse.parent_position_id = 40979
CONNECT BY PRIOR pse.subordinate_position_id = pse.parent_position_id
AND PRIOR pse.pos_structure_version_id = pse.pos_structure_version_id
AND PRIOR pse.business_group_id = pse.business_group_id
ORDER BY 4
Этот комментарий был удален автором.
ОтветитьУдалить