Question about WHILE LOOP
From: sla_m <member_at_dbforums.com>
Date: Thu, 05 Dec 2002 03:53:13 +0000
Message-ID: <2126847.1039060393_at_dbforums.com>
Date: Thu, 05 Dec 2002 03:53:13 +0000
Message-ID: <2126847.1039060393_at_dbforums.com>
i wanna make a program to print the level of the sailor in the is-trained-by tree. program’s output should look like the sample output given below.
Sample output for various inputs
Input Output
28 +++++ No such sailor found: 28 29 +++++ Sailor 29 is at level 0 58 +++++ Sailor 58 is at level 3
and i got a piece of code like this;
--calculates the level for a sailor
WHILE p_trainee != null
LOOP
L := L+1; p_sid := p_trainee; <<<<s.sid; >>>>
-- set p_trainee = SELECT trainee FROM sailors WHERE p_sid =
--prints out path through relationship tree DBMS_OUTPUT.PUT_LINE ('+++++ SID: '||p_sid||' trainee'||p_trainee);
END LOOP; Is there a way of state a temporary look up point for the "SELECT trainee FROM sailors WHERE p_sid = s.sid" so that the 'set p_trainee' would be able to look up the data???
Thanks for your response
--
Posted via http://dbforums.com
Received on Thu Dec 05 2002 - 04:53:13 CET