Recursiv/hierarchical query?

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Jan 22 05:51:17 CST 2009


On 1/22/09 1:46 PM, "Bart Pietercil" <bart.pietercil at cognosis.be> wrote:

>>> Maybe add also a count_branch_depth(tbl_A,link_to_follow,aRecID)
>>> which
>>> would return the number of iterations before reaching the lowest
>>> level
>>> of the branch.
>>> 
>>> Then we could write something like:
>>> 
>>> if(count_branch_depth(tbl_A,link_to_follow,aRecID) > someNumber) then
>>> select tbl_a.* where recid in (select
>>> collect_branch(tbl_a,link_to_follow,aRecid,someNumber))
>>> else
>>> select tbl_a.* where recid in (select
>>> collect_branch(tbl_a,link_to_follow,aRecid))
>>> end if
>> 
>> I do not see sense because exists
>> optional_nr_of_levels_before_returning
> 
> But what will happen when you pass an optional_nr_of_levels that is
> higher then what exists.

So what? This is MAX_LIMIT.

Let exists 3 levels,
You send MAX_LIMT = 5

In answer we get of course 3 exited levels.

In fact YOUR IF() above have this logic as I see.


> I can think of places (ie when building a graphical representation of
> the tree) when I would like to know how deep the nesting will go so I
> can place a limit

Function count_levels()  yes can be useful. Agree.

Just IF() above have no sense in such form I think.


> Bart
> PS: Is this something I can look forward too (if yes, I postpone my
> modification in the db for a few days) or is this more longterm (then
> I need to work around the issue)

We should be able implement this in nearest 2-4 weeks maximum.



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list