in reply to Cleaner code to build hierarchical display of page names
This probably won't help most people, but if you're using Oracle, they support CONNECT BY which is made specifically to do this sort of thing.
SELECT lpad('-', 3*(level-1)) || pagename FROM tablename START WITH under=0 CONNECT BY PRIOR pageid = undef;
|
|---|