Re: Adjacency list to Nested set model statement
Date: 4 Mar 2002 13:56:53 -0800
Message-ID: <c0d87ec0.0203041356.6f2454a9_at_posting.google.com>
>> I've cleaned up the code and posted it at:
http://willets.org/treecrawl.sql <<
SET nxt
- (SELECT MIN(node_id) FROM Tree AS C WHERE C1.parent_id = last_visited AND C1.nodenum IS NULL);
Other products don't have the singleton select or the exception
handling, which are standard. But we can take advantage of the rules
about aggregate functions and emptry sets to get it all into one
statement.
And we should get rid of the sql%rowcount somehow. That one is
proprietary. Can we get a WHILE condition at the start of the loop
based on the size of the tree?
>> One only needs a stack if a node can have multiple paths to it from
root. <<
But then it is not a tree.
>> I have another idea for a more parallelizable algorithm based on
some
stuff I did a few years ago. I'll see if I can reconstitute the stuff
I
need to try that out. <<
Neat! Received on Mon Mar 04 2002 - 22:56:53 CET