Cursors and recursion - bom explosion
Posted in 1995
> > I have a table that contains a hiearchy of items where where each record > references another record as its parent. very true. You can't do it. You CAN do a recursive SPL. OR (what we did before SPLs) - you can do the following: read all parents into an array. index into array keep track of last open slot. starting at beginning of array (index2), read for children, putting anything found into the end of the array. when index2 = index1 you have finished the explosion. At this point you have a flat list which includes all parents and children. from there you can further put things back together if you like. (hint - use a link list) I have some code that does this that I could probably share. I've never had the need to preserve the actual indentation although I think I did it once somewhere in here. Holler if you like and I'll dig it out. cheers j. _____________________________________________________________________________ Jack Parker - Hewlett Packard, BSMC Boise, Idaho, USA jparker@hpbs3645.boi.hp.com _____________________________________________________________________________ "Character is what you are in the dark" - Emilio Lizardo _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________