| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: SQL help requested - "linked list"
Thanks everybody (esp. Mikito)!
Using the "connect by" construct does the trick. The information about using "connect by" talks about family tree and other hierarchies. Basically my linked list scenario can be treated as one. It's just a hierarchy with nodes but no branches.
Using the example that Lennart graciously provided, the Oracle version goes like this:
To go down the list:
select id from list
start with id = 3
connect by prior id = nextid;
and up the list:
select id from list
start with id = 3
connect by id = prior nextid;
Just what I needed! Thanks again.
-Mia Received on Fri Aug 22 2003 - 18:07:20 CDT
![]() |
![]() |