Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: SQL help requested - "linked list"

Re: SQL help requested - "linked list"

From: Mia <nospam_at_cox.net>
Date: Fri, 22 Aug 2003 16:07:20 -0700
Message-ID: <3F46A228.8010004@cox.net>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US