Subject Re: should this work?
Author alex_vnru
--- In ib-support@y..., "Vince Duggan" <vince@r...> wrote:
> I think I tried that at one point and did not get reliable results.
What I
> do is the following:
>
> create exception loop_breaker 'Loop Breaker';
>
> create procedure...
>
> begin
> for select....
> begin
>
> if (endcondition) then
> exception exception_breaker;
> end
> when any do
> begin
> a = a;
> end
> end

Vince, for selectable procedures it is reliable if you use
When exception exception_breaker
instead of
When Any - to don't mask other exceptions. But if you have'nt need in
any processing within procedure after For Select loop, simplest way to
break _procedure_ execution is
if (endcondition) then Exit; :)

Usage of user defined exception as loop breaker when there is data
changes within loop is some more sophisticated. You should remember
difference between IB and FB - IB don't discard changes when user
defined exception is raised and handled in When ... Do, FB don't make
difference between system and user exceptions (personally I think it
is more correct behavior). Remember also that both IB and FB discards
only changes made after last SUSPEND when exception is raised but
transaction within which context procedure was called is commited
anyway.

Best regards, Alexander V.Nevsky.