Subject | Breaking out of For Select...Do |
---|---|
Author | jmartine3 |
Post date | 2003-05-06T09:53:36Z |
I am writing my very first stored procedure, so please forgive my very
newbie type questions.
I'm doing a For Select...Do loop. There is a point in the loop where
I will have reached a condition where I'm done with the loop (I don't
want to even look at the rest of the rows returned from the Select).
Is there a way to break out of the loop.
Example:
for select MY_NUM from MY_TABLE into :THIS_NUM
do
BEGIN
THE_TOTAL = THE_TOTAL + THIS_NUM;
if (THE_TOTAL >= 500) then
/* somehow break out of the loop */
END
Thanks,
Joe
newbie type questions.
I'm doing a For Select...Do loop. There is a point in the loop where
I will have reached a condition where I'm done with the loop (I don't
want to even look at the rest of the rows returned from the Select).
Is there a way to break out of the loop.
Example:
for select MY_NUM from MY_TABLE into :THIS_NUM
do
BEGIN
THE_TOTAL = THE_TOTAL + THIS_NUM;
if (THE_TOTAL >= 500) then
/* somehow break out of the loop */
END
Thanks,
Joe