need help with recurrent select
Posted in 1998
Topics: Stored Procedures & SPL
hello,
i have in a table t two columns (keys) gozid and ozid and other columns.
These 2 columns have a recurrent relationship. Following example will
explain my problem:
1. step:
select unique gozid from t where ozid = 0815;results (f.e.): 1214,1218 (to store)
now i have to search like that:
select unique gozid from t where ozid = 1214 or ozid = 1218;
possible results: 2010,4030,4040 (to store)
Now i have to select again like following:
select unique gozid from t where ozid = 2010 or ozid = 4030 or ozid =4040;
Result: xy (to store)
and so on until no result will be found anymore.
2. step:
At least a select like that:
select * on table t where <conditions> and (ozid = 1214 or ozid = 1218
or ozid = 2010 .....)
Questions:
Can i solve the first step with a recurrent stored procedure and how i
should do this? Is there any solution for step 1 and step 2 within one
select-statement/stored procedure ?
Suggestions are welcome.
Thanks
--
Sabina Wahl
ASW PS12
Email: swahl.str@sni.de