This page explains the hierarchical query using the (start with) connect by clause in an Oracle SQL Query.
http://www.oradev.com/connect_by.jsp
SELECT LPAD(' ', 2*level-1)|| SYS_CONNECT_BY_PATH(last_name, '/') "Path"
FROM employees
CONNECT BY PRIOR employee_id = manager_id
See also: http://www.orafaq.com/node/2038