Subject Unioning result sets to return from stored proc. (maybe temp table?)
Author josephhirn
I need a query/procedure that will return depth first enumeration of
the leaf nodes in a hierarchial structure stored in my database.
Ultimately this procedure will be called via JDBC and I would like it
to return a single result set in the proper order.

I can easily write a procedure with nested loops to traverse to the
proper node where I would just call a "select * ... order by ..." to
get the leafs in the proper order. My problem is how to union all the
records for each call to my "select * ... order by ..." query for
returning in the resut set. Should I store results in a temp table
(can I)?

We are using firebird 1.0.3.

Any help is greatly appreciated. Thanks a ton in advance!