SELECT tree, sys_connect_by_path(name, '/') as tree_path from ( SELECT rownum rn, ptree, tree, name FROM (SELECT id, SUBSTR (tree, 1, INSTR (tree, '.', -1, 2)) ptree, tree, name FROM supermag.sacardclass) START WITH id = :idclass CONNECT BY prior ptree = tree ) WHERE rn=1 START WITH ptree is null CONNECT BY ptree = prior tree