Query to get a sorted list of the complete (root to child) path of an Apex list.
The case statement to determine the menu_target is not bulletproof, but it works.
Even though it should resolve to a page_id, the entry_target might contain other (javascript) code which I have not dealt with here.
Therefore I left it as a varchar2, and then outer joined it to the application_pages view.
It handles these types of targets:
f?p=&APP_ID.:1000:&SESSION.::NO::::
and
javascript:window.open('f?p=1234:1000:&APP_SESSION.::', '_blank')
Note that the query does not take the application_id into account - shouldn't be a problem in most cases.