Subject | Re: [firebird-support] Re: multiple nested loops question |
---|---|
Author | Robert martin |
Post date | 2005-03-11T00:54:41Z |
Hi
I am just a beginner to but I think you dont need the For - Do around
the final SQL. You are running this once for each record in the SQL
before it, so you should just do the SQL and suspend to return the record.
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
donoghue_brendan wrote:
I am just a beginner to but I think you dont need the For - Do around
the final SQL. You are running this once for each record in the SQL
before it, so you should just do the SQL and suspend to return the record.
Rob Martin
Software Engineer
phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com
Wild Software Ltd
donoghue_brendan wrote:
>Thanks for your help.
>
>Each loop is now terminated with an END and the query compiles just fine.
>
>However when I run it I get a multiple rows in a singleton select. I
>dont understand why I am getting this now. I thought that with only 1
>suspend at the end the procedure would loop through then return a row
>at a time to the client? What have I done wrong?
>
> FOR SELECT
> DISTINCT STUDENT_ID
> FROM STUDENT_FORM_RUN
> INTO :STU_STU_NUMBER
> DO BEGIN
> 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 BEGIN
> FOR SELECT
> DISTINCT 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;
> END
> END
> END!!
>
>
>Thanks
>
>Brendan
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>