db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Leroux <s...@wanadoo.fr>
Subject Re: Recursive query on common table
Date Thu, 15 Oct 2009 14:23:39 GMT

Here is a quick and dirty class I wrote yesterday in order to experiment with 
the (very useful) table function wrappers provided by Rick.

This function will return the list of all children from a given node (through 
the relation Zones.ref <--> Zones.parent).
The table name and the column that serves as reference to the parent node are 
all hard coded. But I think you might be found that useful.

Please note that in it current implementation, it could be used both for trees 
and graphs containing cycles.

Hope this helps,

Vrin26 a écrit :
> Hi,
> Can any one help me with an idea, how I can do  a recursion for this issue. 
> Thanks.
> Rick Hillegas-2 wrote:
>> Vrin26 wrote:
>>> Hi,
>>> I need to do a recursive query on a single derby database table.
>>> In Derby database documents it is mentioned that this derby doesn't
>>> support
>>> recursive queries.
>>> Is there any other work around to handle this scenario?
>>> Thanks
>> You can push the recursion into a table function or into a database 
>> procedure which returns a result set. The table function documentation 
>> talks about wrapping external data sources, but you can also use table 
>> functions to wrap complicated processing inside Derby itself. See 
>> http://db.apache.org/derby/docs/10.5/devguide/devguide-single.html#cdevspecialtabfuncs

>> The CREATE PROCEDURE statement is documented here: 
>> http://db.apache.org/derby/docs/10.5/ref/ref-single.html#crefsqlj95081
>> Hope this helps,
>> -Rick

Website: http://www.chicoree.fr

View raw message