Recursive stored procedures

Bart Pietercil bart.pietercil at cognosis.be
Wed Jan 21 14:57:51 CST 2009


On 21 Jan 2009, at 21:38, Ruslan Zasukhin wrote:

> On 1/21/09 8:42 PM, "Bart Pietercil" <bart.pietercil at cognosis.be>  
> wrote:
>
> Hi Bart,
>
>> Hi List, Ruslan
>>
>> short question:
>> can SP's call themselves recursively ?
>
> It seems yes.
>
> But be careful,
>
>    if you will not make right RETURN branches
>    you will get endless loop
>
>    also issue with deep of recursion.
>    I think it can be until eat the whole RAM :)

hmmm, I know I rather would not use it, but I am looking for a way to  
search a table that has the 'adjacent tree' model

like
recid-somefields-objptr_parentid

1-blabla-null
2-bll-1
3-hi-null
4-dhsi-2

and now I need a select that given recid 1 wil return the recids 1,2,4
and this for a unknown depth of nesting.
It looks like I would need recursive joins (which I don't see  
available in Valentina SQL) or a recursive procedure.

Still think this should be doable using the correct joins and where  
statements and only one select, just don't see how for the moment.
Flue does not help either.


Bart


More information about the Valentina mailing list