http://qs321.pair.com?node_id=438761


in reply to Re^2: reordering a stack with little effort
in thread reordering a stack with little effort

In Oracle you can use CONNECT BY to do this:

SELECT id FROM thetable START WITH id = 1 CONNECT BY PRIOR next = id