Subject multiple nested loops question
Author donoghue_brendan
Good Morning.

First of all thanks for all the help that this group, esp Helen, has
given me over the past 2 weeks, you have made transition to firebird
considerably less painfull for me than it could have been. :)

But, I still have another question. I am unsure of the syntax to use
for the following nested loops that I have in a stored procedure. This
query returns multiple rows at each loop. I have tried adding a FOR
SELECT at each loop but because I dont want to return the rows to the
client with a SUSPEND I am unsure how to pass them to the next loop.

Thanks

Brendan

FOR SELECT
STUDENT_ID
FROM STUDENT_FORM_RUN
INTO :STU_STU_NUMBER
DO SUSPEND
FOR SELECT
STUDENT_ID, START_DATE, END_DATE
FROM
GET_FORM_DATES(:STU_STU_NUMBER)
INTO
:PROC_STUDENT_ID, :PROC_START_DATE, :PROC_END_DATE
DO SUSPEND
FOR SELECT
STU.STUDENT_ID, 'CURRENT_ENROLLMENT'
FROM
STU_ENROLMENT STU
WHERE
:PROC_STUDENT_ID = STU.STUDENT_ID
AND :PROC_START_DATE < :DATE_TO
AND :PROC_END_DATE > :DATE_TO
AND STU.APP_CANCELLED IS NULL
INTO :STUDENT_ID, :STATUS_TEXT
DO SUSPEND;