This is the code:
SELECT
'FXE_I_823' AS KEY,
listagg(ftn.pk1_start_value || '|' || ffvv.description, '|')
within GROUP (ORDER BY DEPTH) "TREE_CODE"
FROM
fnd_tree_node ftn,
fnd_flex_values_vl ffvv
WHERE 1=1
AND ftn.pk1_start_value = ffvv.flex_value
AND ftn.tree_code = 'ARA40'
AND ffvv.value_category = 'COST CENTER'
I am getting the below output:
ARA40|ARA40|REG059|Reg 59 - Ops-Transport North|DST0418|Dist 418 Trans OpsPhiladelphia|CLU5110|Cluster 5110|SPK5110|Spoke Centers 5110|1623501|1623501 - LOMG Retail Location|1623507|1623507 - Retail Freight Service ACIM
But I am expecting the output like this:
ARA40|REG059|Reg 59 - Ops-Transport North|DST0418|Dist 418 Trans OpsPhiladelphia|CLU5110|Cluster 5110|SPK5110|Spoke Centers 5110|1623501|1623501 - LOMG Retail Location
ARA40|REG059|Reg 59 - Ops-Transport North|DST0418|Dist 418 Trans OpsPhiladelphia|CLU5110|Cluster 5110|SPK5110|Spoke Centers 5110|1623507|1623507 - Retail Freight Service ACIM
The last node should not come in first line and come in second line like recusrion and also the parent node ARA40 should not fetch description only child nodes from second value should have description. Can someone please help