SELECT DISTINCT
ORGANIZATION_ID AS ID,
ORGANIZATION_NAME AS TEXT,
NVL (PARENT_ID, 0) AS PID,
'' AS PS,
'' AS PN,
'' AS POST,
'' AS XB
FROM
TE_ORGANIZATION CONNECT BY PRIOR PARENT_ID = ORGANIZATION_ID START WITH ORGANIZATION_ID IN (
SELECT
A .ORGANIZATION_ID
FROM
TE_CUSTOMER A,
TR_PLATFORM_CUSTOMER B
WHERE
A.DEL_FLAG='0'
AND A .ORGANIZATION_ID IS NOT NULL
AND A .CUSTOMER_ID = B.CUSTOMER_ID
AND B.PLATFORM_ID = 2
)
AND DEL_FLAG = 0
ORDER BY CAST(ID AS INT)