SELECT
FTN.PK1_START_VALUE CHILD_ACCOUNT ,
FTN.PARENT_PK1_VALUE PARENT_ACCOUNT,
FVV.DESCRIPTION PARENT_ACCOUNT_DESCRIPTION
FROM
FND_TREE_NODE FTN,
FND_FLEX_VALUES_VL FVV
WHERE
FTN.TREE_STRUCTURE_CODE ='GL_ACCT_FLEX'
AND FTN.TREE_CODE ='GDI_ACC_HIE' -- Please Enter Your Organization Account Hierarchy Code
AND FTN.PK1_START_VALUE =GCC.SEGMENT4 --Child Account '511109'
AND FTN.PARENT_PK1_VALUE =FVV.FLEX_VALUE
AND FTN.TREE_VERSION_ID IN
(
SELECT
TREE_VERSION_ID
FROM
FND_TREE_VERSION_VL
WHERE
TREE_STRUCTURE_CODE ='GL_ACCT_FLEX'
AND TREE_CODE ='GDI_ACC_HIE'
AND STATUS ='ACTIVE'
AND TRUNC(SYSDATE) BETWEEN EFFECTIVE_START_DATE AND EFFECTIVE_END_DATE )