Re: PL/SQL procedure question

From: DanHW <danhw_at_aol.com>
Date: 21 Jan 1999 01:58:45 GMT
Message-ID: <19990120205845.21446.00000377_at_ng-fw1.aol.com>


>I need to write a PL/SQL procedure that will produce an indented output based
>on a child/parent relationship: Two tables involved a master table that
>stores documents doc_no is PK and a child/parent table that stores the
>associated docs for a given doc_no. The report needs to explode up to 15
>levels. So for the doc_no passed to the procedure, I need the direct
>descendants and each of its child records up to 15 levels. I want to
>establish the levels and report them in an indented format Any ideas?--I set
>up 15 cursors and looped through but I am not getting the results I need
>

Try the CONNECT BY construct in SQL. However, in all honesty, I used that also once, but you can't do an order by in it. What I ended up doing was adding columns to the table that were the denormalized 'labels' with leading spaces, and the nesting level. Then I could sort the way I wanted. Hope that helps.

Dan Hekimian-Williams Received on Thu Jan 21 1999 - 02:58:45 CET

Original text of this message