Assume we have a table of locations like Name Null? Type ----------------------------------------- -------- ----------------- ID NOT NULL NUMBER NAME NOT NULL VARCHAR2(50) and a table of possible lines (or route parts) like Name Null? Type ----------------------------------------- -------- -------- ID NOT NULL NUMBER FROM_LOC_ID NOT NULL NUMBER TO_LOC_ID NOT NULL NUMBER DISTANCE NOT NULL NUMBER How can we calculate the best route (in this case: the route with the shortest distance) from a startpoint to an endpoint? The answer is: By using an hierarchical query: select dep_name , arr_name , route , distance , execute(distance) total from ( select connect_by_root dep.id dep_id , conn