'Skip a loop iteration with Firebird 2.5

I need to skip a While...Do loop iteration inside a stored procedure like this

While (v_counter <= :v_total) do begin

  If (<condition>) then continue;

  ...

end

However CONTINUE won't be available until Firebird 3.0. Is there a work a round for this?



Solution 1:[1]

If you want to skip an iteration through a loop without CONTINUE, then just use the inverse of the continue-condition for the rest of the block:

While (v_counter <= :v_total) do begin

  If (NOT <condition>) then
  BEGIN
     ...
  END

end

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark Rotteveel