Search code examples
sqlfirebirdfirebird2.5

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

  • If you want to skip an iteration through a loop without CONTINUE, then you can 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