Traversing a Tree Structure in Pro*C
From: Lyle D. Brooks <brooks_at_usiva.com>
Date: Thu, 26 Aug 1993 14:50:19 GMT
Message-ID: <1993Aug26.145019.18629_at_usiva.com>
Date: Thu, 26 Aug 1993 14:50:19 GMT
Message-ID: <1993Aug26.145019.18629_at_usiva.com>
How do you approach this in Pro*C?? I tried using cursors, but you can't DECLARE/OPEN cursors recursively, or can you?
Given a table structure such as
SQL> desc TREE_DATA
Name Null? Type ------------------------------- -------- ---- NODE_ID NOT NULL NUMBER(3) LEFT_NODE_ID NUMBER(3) RIGHT_NODE_ID NUMBER(3) NODE_DATA CHAR(30)
and a NODE_ID, how do you traverse the sub-tree for the given NODE_ID and print out the NODE_DATA of each node you visit?
Many thanks in advance!!
-- Lyle D. Brooks UUCP : uunet!usinet!brooks Universal Systems Incorporated Internet : brooks_at_usiva.com 4350 Fair Lakes Court Fairfax, VA 22033 (703) 222-7253Received on Thu Aug 26 1993 - 16:50:19 CEST