Subject | Re: How to select all child records of a given parent in a self referencing table |
---|---|
Author | Erik De Laet |
Post date | 2009-06-26T11:23:12Z |
> create procedure sp_tree (spid integer) returns (id integer, pid integer) asThank you very much, this works as a charm !
> begin
> for select id, pid from tree where pid=:spid into :id, :pid do
> begin
> suspend;
> for select id, pid from sp_tree(:id) into :id, :pid do
> suspend;
> end
> end
> ^
>
> than: select * from sp_tree(0);
While I have read Helen's book completely when I bought it (a couple of years back), it never occured to me (now that I needed it), that I could call a stored procedure recursively.
What a great community ... thanks again.